Skip to content

Error envelope

Tool errors are a JSON envelope in the text result. isError is true. Do not scrape a free-text sentence when this object is present.

{
"error": {
"code": "NOT_ALLOWED",
"message": "...",
"path": "C:\\proj\\file.txt",
"details": {},
"suggestion": "call list_allowed_directories",
"retryable": false,
"recovery": "fix_arguments"
}
}

OCC_MISMATCH also includes expected_hash, current_hash, and conflict.

retryable: true means use the envelope before another call. It does not authorize replaying the same mutation.

Filesystem codes set retryable true only for:

Coderecovery
OCC_MISMATCHread_and_rebase
HASH_REQUIREDread_and_rebase
STALE_GITread_and_rebase

Every other filesystem code has retryable: false.

recovery values used by the filesystem mapper:

recoveryCodes
read_and_rebaseOCC_MISMATCH, HASH_REQUIRED, PATCH_FAILED, STALE_GIT
check_already_appliedROLLBACK_PARTIAL, ROLLBACK_FAILED, ROLLBACK_COMPLETE
fix_argumentsthe rest

PATCH_FAILED is not retryable. Read the file and regenerate the hunk. Do not send the same patch again.

CodeWhen
NOT_ALLOWEDPath is outside the allowlist.
NOT_FOUNDPath is missing.
ROOTS_EMPTYNo sandbox roots.
SECRET_DENIEDSecret filename, and --allow-secrets is off.
FILE_POLICY_DENIEDFile security policy blocked the call.
READONLYMutating tool while --readonly.
VALIDATIONUnknown or wrong parameter.
REWRITE_BLOCKEDAccidental full-file rewrite. Use write_file or allow_rewrite.
OCC_MISMATCHexpected_hash does not match.
HASH_REQUIRED--auto-occ=block and no expected_hash.
PATCH_FAILEDUnified diff did not apply.
BEGIN_PATCHCodex *** Begin Patch, not a unified diff.
BUDGET_EXCEEDED--mutation-budget reached.
STALE_GITexpected_status_hash does not match. No diff body.
TOOL_UNAVAILABLETool is not available in this process.
ROLLBACK_COMPLETEJournal rolled back.
ROLLBACK_PARTIALJournal rollback was partial.
ROLLBACK_FAILEDJournal rollback failed.
GH_CLI_MISSINGgh is not installed.
GH_AUTH_REQUIREDgh is not authenticated.
GH_FORBIDDENGitHub denied the call.
GH_NOT_FOUNDGitHub repo or issue missing.
GH_RATE_LIMITGitHub or GitLab rate limit.
GH_NETWORKGitHub network or transport failure.
GH_AMBIGUOUSMore than one GitHub repo matches.
GH_REPO_UNRESOLVEDCould not resolve owner/repo.
GH_OUTPUT_LIMITgh output was capped.
GH_NOT_ISSUEThe number is not an issue.
GH_HOST_DENIEDHost is outside --git-remote-allow.
GH_FAILEDOther gh failure.
GL_AUTH_REQUIREDGitLab auth failed.
GL_NOT_FOUNDGitLab project or issue missing.
GL_FORBIDDENGitLab denied the call.
GL_NETWORKGitLab network or HTTP failure.
GL_AMBIGUOUSMore than one GitLab remote matches.
GL_REPO_UNRESOLVEDCould not resolve the GitLab project.

Issue tools set retryable on the call, not only from the table above. GH_RATE_LIMIT and GH_NETWORK are retryable for reads only. GitLab network and 5xx reads can be retryable. A GitLab write that fails in transit may already have been applied. Check the issue. Do not retry it automatically.