How to keep Claude Code's claude -p auto mode runs from failing on unchecked actions with an environment variable
When you run claude -p in auto mode from CI or a script, a classifier model reviews each action. Since 2.1.337, released December 4, a run in which auto mode could not check an action ends with is_error: true and exit code 1. Agent SDK runs behave the same way. Before, only that action was blocked and the run still ended as a success.
claude -p "Update the dependency pins and run the tests" --permission-mode auto --output-format json
echo $? # 1 if an action went unchecked
Per the docs, auto mode can't check an action when a separate safety check refuses the classifier's own request, when the classifier's response doesn't parse, or when server-side classifier review returns no verdict. That is different from an action the classifier reviewed and blocked.
To get exit code 0 as before, set the environment variable:
CLAUDE_CODE_DISABLE_UNCHECKED_ACTIONS_ERROR=1 claude -p "Update the dependency pins and run the tests" --permission-mode auto
Things to keep in mind:
- The variable is only in the changelog so far, not in the environment variable reference. Use the value
1the changelog gives. - Pipelines that judge success by exit code can start failing after the upgrade to 2.1.337. Look at which actions went unchecked before you opt out. With
--output-format stream-json, denials appear aspermission_deniedmessages and the final result lists them inpermission_denials. - With it set, unchecked actions still don't run, but the run reports success. Opt out only where someone reviews the output afterwards.
Sources
Get notified when a new tip lands
Tip alerts only go out in the app. Install it and turn notifications on.