godotengine / godotengine/godot

Running an invalid script in headless mode results in a popup

Open
#109,481 0 comments 0 reactions 0 assignees View on GitHub
discussion enhancement topic:core
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

v4.4.1.stable.official [49a5bc7b6]

### System information

Godot v4.4.1.stable - macOS Sequoia (15.6.0) - Multi-window, 1 monitor - OpenGL 3 (Compatibility) - Apple M2 Pro - Apple M2 Pro (12 threads)

### Issue description

Running a script that does not inherit from SceneTree or MainLoop while in headless mode results in a modal popup alert. You must click the "ok" for it to exit. While this makes sense in normal cases, I would not expect to get a modal popup when running in headless mode. Furthermore, the error you get back at the command line is "libc++abi: terminating due to uncaught exception of type std::__1::system_error: recursive_mutex lock failed: Invalid argument" instead of the alert message.

It should simply return the alert in the terminal console and not block.

### Steps to reproduce

In the attached project, run
`godot --headless --script empty.gd`

(I originally got this on code that was extending Node, but found it also happens on empty scripts.)

### Minimal reproduction project (MRP)

[minimal_headless_alert_bug.zip](https://github.com/user-attachments/files/21703202/minimal_headless_alert_bug.zip)

Contributor guide

Open the contributing guide

Research direction

Start with the attached minimal reproduction project and run `godot --headless --script empty.gd` to observe the modal alert and terminal error. Trace the headless handling of the invalid script and make the alert appear in the terminal without blocking; verify that the command exits cleanly without requiring a click.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, godot
Domain
cli, game-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.