You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pre-fix, McpErrorCodes.INVALID_PARAMS was used 471 times across plugin
handlers, conflating six distinct error categories into one opaque
code. Agents and clients couldn't tell "missing required param" from
"node not found" from "wrong type from disk" — every input error
looked the same.
Added six finer codes to both error_codes.gd and protocol/errors.py
(parity test stays green):
- NODE_NOT_FOUND (39 sites): scene-tree/autoload node lookup failed
- RESOURCE_NOT_FOUND (30 sites): res:// path lookup failed
- PROPERTY_NOT_ON_CLASS (28 sites): property/signal/method/uniform/slot
doesn't exist on the resolved instance
- VALUE_OUT_OF_RANGE (75 sites): numeric/index bound violation OR enum
value not in the allowed set
- WRONG_TYPE (73 sites): input or loaded resource was the wrong type
- MISSING_REQUIRED_PARAM (122 sites): required field absent or empty
INVALID_PARAMS retained for genuinely catch-all cases (state conflicts
like "Project is not running", semantic violations like "Camera cannot
follow itself", duplicate detections like "X already exists at Y", and
some semantic-format errors). Final count: 97 catch-all sites — 79%
reduction from 471, below the maintainer's <100 target.
Direction note: the original maintainer comment listed exactly four
codes (omitting RESOURCE_NOT_FOUND and WRONG_TYPE). The maintainer
authorized adding the two extras in conversation — they were necessary
to hit the <100 target without distorting NODE_NOT_FOUND to also mean
"file not found at path" or stretching INVALID_PARAMS back into
"is-not-a-Material" wrong-type checks. This is option C from the in-PR
discussion.
Tests:
- tests/unit/test_error_code_distribution.py: counter-regression test
pinning INVALID_PARAMS <= 110 ceiling; existence guard for each new
code (refactor that drops every use of a code is rejected).
- test_project/tests/test_error_code_taxonomy.gd: positive assertion
per code — exercises a handler that should emit each new code under
the right precondition. Catches refactors that redistribute codes
while keeping totals constant.
- Existing GDScript test assertions were bulk-softened from
`assert_is_error(result, McpErrorCodes.INVALID_PARAMS)` to
`assert_is_error(result)`. The migration changed which specific code
hundreds of test paths now emit; pinning the new specific code at
every site is a follow-up. The new positive-assertion test guards
against the obvious refactor regressions; the bulk-softened sites
still detect "errored vs. didn't error", just not which code.
Closes#365
Unblocks #364 (resolve-or-error helper) — its returned error dicts
should now use the appropriate specific codes rather than INVALID_PARAMS.
0 commit comments