Skip to content

"CLI-Anything: Making ALL Software Agent-Native" -- CLI-Hub: https://clianything.cc/

Python

fix(godot): detect GDScript parse errors via stderr in validate_script

Rubiadragona0ab4c7710ab
diff --git a/godot/agent-harness/cli_anything/godot/core/script.py b/godot/agent-harness/cli_anything/godot/core/script.py
index b0e15c99b..948320fc4 100644
--- a/godot/agent-harness/cli_anything/godot/core/script.py
+++ b/godot/agent-harness/cli_anything/godot/core/script.py
@@ -124,10 +124,15 @@ def validate_script(project_path: str, script_path: str) -> dict:
timeout=30,
)
- valid = result["returncode"] == 0
+ # Godot 4.6.x exits 0 even on parse errors with --check-only, so the
+ # return code alone is unreliable. Also scan stderr for error markers.
+ stderr = result["stderr"] or ""
+ error_markers = ("SCRIPT ERROR", "Parse Error", "Failed to load script")
+ has_error = any(marker in stderr for marker in error_markers)
+ valid = result["returncode"] == 0 and not has_error
return {
"status": "ok",
"script": script_path,
"valid": valid,
- "errors": result["stderr"] if not valid else "",
+ "errors": stderr if not valid else "",
}