godotengine / godotengine/godot

Inheriting from Translation class in gdscript crashes the Editor & Game on startup

Open
#101,073 6 comments 1 reaction 0 assignees View on GitHub
bug crash topic:core topic:i18n
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

Reproducible in 4.3.stable

### System information

Godot v4.3.stable - macOS 15.1.1 - Vulkan (Mobile) - integrated Apple M3 Pro - Apple M3 Pro (12 Threads)

### Issue description

I am trying to implement my own Translation Class in GDScript to do some data processing in the background. But when I try to use my own class (even when it's an emtpy class that just has name & extends Translation) and add this to the ProjectSettings->Localization the Godot Editor crashes when i reopen the project or when I start the game.
I can't get a log from the editor but the game when launched returns this crash in the log:
```
Godot Engine v4.3.stable.official.77dcf97d8 - https://godotengine.org
Vulkan 1.2.283 - Forward Mobile - Using Device #0: Apple - Apple M3 Pro

================================================================
handle_crash: Program crashed with signal 11
Engine version: Godot Engine v4.3.stable.official (77dcf97d82cbfe4e4615475fa52ca03da645dbd8)
Dumping the backtrace. Please include this when reporting the bug to the project developer.
[1] 1 libsystem_platform.dylib 0x000000018ed40184 _sigtramp + 56
[2] GDScriptParser::parse_identifier() (in Godot) + 36
[3] GDScriptParser::parse_class_name() (in Godot) + 228
[4] GDScriptParser::parse_program() (in Godot) + 1404
[5] GDScriptParser::parse(String const&, String const&, bool, bool) (in Godot) + 1956
[6] GDScriptParserRef::raise_status(GDScriptParserRef::Status) (in Godot) + 724
[7] GDScriptCache::get_parser(String const&, GDScriptParserRef::Status, Error&, String const&) (in Godot) + 520
[8] GDScriptCache::get_shallow_script(String const&, Error&, String const&) (in Godot) + 644
[9] GDScriptCache::get_full_script(String const&, Error&, String const&, bool) (in Godot) + 220
[10] ResourceFormatLoaderGDScript::load(String const&, String const&, Error*, bool, float*, ResourceFormatLoader::CacheMode) (in Godot) + 84
[11] ResourceLoader::_load(String const&, String const&, String const&, ResourceFormatLoader::CacheMode, Error*, bool, float*) (in Godot) + 696
[12] ResourceLoader::_thread_load_function(void*) (in Godot) + 580
[13] ResourceLoader::_load_start(String const&, String const&, ResourceLoader::LoadThreadMode, ResourceFormatLoader::CacheMode) (in Godot) + 1608
[14] ResourceLoaderBinary::load() (in Godot) + 816
[15] ResourceFormatLoaderBinary::load(String const&, String const&, Error*, bool, float*, ResourceFormatLoader::CacheMode) (in Godot) + 784
[16] ResourceLoader::_load(String const&, String const&, String const&, ResourceFormatLoader::CacheMode, Error*, bool, float*) (in Godot) + 696
[17] ResourceLoader::_thread_load_function(void*) (in Godot) + 580
[18] ResourceLoader::_load_start(String const&, String const&, ResourceLoader::LoadThreadMode, ResourceFormatLoader::CacheMode) (in Godot) + 1608
[19] ResourceLoader::load(String const&, String const&, ResourceFormatLoader::CacheMode, Error*) (in Godot) + 84
[20] TranslationServer::_load_translations(String const&) (in Godot) + 296
[21] TranslationServer::load_translations() (in Godot) + 52
[22] Main::setup2(bool) (in Godot) + 11608
[23] Main::setup(char const*, int, char**, bool) (in Godot) + 55888
[24] main (in Godot) + 300
[25] 25 dyld 0x000000018e988274 start + 2840
-- END OF BACKTRACE --
================================================================

```

### Steps to reproduce

Create a GDScript class that extends Translation, create an Resource instance of it and set it under ProjectSettings->Localization.

```
@tool
class_name TranslationGoogleSheet
extends Translation
````

A simple class like this is enough.

### Minimal reproduction project (MRP)

This Project has the most simple Translation class & an instance of the resource set as localization. When you try to open the project the Godot Editor immediately crashes. To open the project, remove the Localization Setting from the project.godot file.
```locale/translations=PackedStringArray("res://test.translation")```

[godot_localization_bug.zip](https://github.com/user-attachments/files/18300495/godot_localization_bug.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached minimal reproduction project and the TranslationServer::_load_translations path shown in the backtrace. Trace the resource load into GDScriptParser::parse_identifier() and parse_class_name(), then verify that reopening the project and starting the game with the Translation-derived resource no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.