GDSense how-to guide

Fix Godot Errors with GDSense

Reproduce a Godot failure, attach focused runtime evidence, inspect the first cause, and verify the correction.

Published Updated

All documentation guides

The short answer

Start with a reproducible failure and the first relevant error. Attach the affected script and, in GDSense 1.4.0, @errors or @log. Ask for a diagnosis tied to that evidence, review the proposed change, then run the same reproduction again.

Capture one failure at a time

Save the project and record the scene, input, and expected result. Reproduce once, then inspect Output and Debugger. A parse error prevents a script from loading; a runtime error happens during execution; incorrect gameplay may produce neither. Do not treat all three as the same problem.

Godot 4.7 debugging tools

Give the error enough context

Attach the script that owns the failing line and describe the scene hierarchy or node path it expects. For a null instance error, inspect where the value is assigned and whether that node exists at that moment. For a parser error, include the complete function rather than a detached line.

Choose Attach errors on the Errors from last run (N) chip or type @errors to attach the captured errors. Attaching errors is opt-in; running the game or sending a message alone does not attach them. Add @log only when printed values help explain ordering. Logs are bounded: if the first failure is missing, reproduce a smaller case and include the relevant redacted message explicitly.

Focused diagnosis request
@errors
@file res://scripts/inventory.gd
Open Inventory immediately after loading Level2. Expected: item slots appear. Actual: the panel remains empty. Trace the first error to its cause. Preserve the save format and explain any change before applying it.

Review the correction

Check that proposed methods exist on the actual node type and that paths match the scene. A type annotation can expose a wrong assumption, but it cannot create a missing node. Avoid broad rewrites while debugging a narrow failure.

Godot 4.7 GDScript reference

Repeat the failing action

Run the same scene and inputs, then try a nearby boundary: empty inventory, repeated open/close, or a fresh level transition. Confirm both the expected behavior and the absence of the original error. Agent verification reports a check result; it does not replace this gameplay test.

If the failure remains, supply the new first error and the diff. Keep the previous working version available and avoid stacking speculative fixes. Review attachments for secrets before sending.

Try this workflow inside Godot

Use GDSense to ask questions, attach the context you choose, and review proposed changes without leaving the editor.