<aside>
💡 This page gives you the five checks to run when your Claude Code agent reports a failed run, plus the prompt to build them.
</aside>
The five checks
Run these in order before you rerun anything. Together they stop an agent from redoing work it has already finished.
- Read the transcript before the error: look at what the agent wrote just ahead of the failure. In the post's case, the final answer had landed 3 to 6 seconds before each error, across 39 errors logged from 8 to 11 October.
- Only count answers from this run: ignore any answer that is older than the current run, so an old result cannot pass as a new one.
- Find the file on disk: look for the output file itself. If the run says done but there is no file, treat it as failed.
- Make the file pass your checks: the render has to pass its own checks, such as no black ending, a keyword and a guide.
- Cap the retries, then get warned: an empty reply gets 3 retries, then you get a warning on your phone.
A pass proves the file exists. It still needs a review.
The prompt is in the last section. Paste it into ChatGPT (Codex) or Claude Code.
How to set it up
- Find where Claude Code saves its session transcript for each run, and make your script read the end of it when a run reports an error.
- Take the last assistant answer in that transcript and check that it was written during the current run, not an earlier one.
- Look for the output file on disk, such as the finished video, and mark the run as failed if the file is missing.
- Run your own checks on the file, such as no black ending frame, the keyword present and the guide present, using ffmpeg for the video checks.
- Count the retries for an empty reply and stop at 3.
- Send yourself a phone alert, for example through Telegram, when the cap is reached.
- Log each run saved by the transcript check, so you can see how often a reported failure was really finished.
- Keep a human review step, because a passing file is not proof the output is good.
<aside>
⚠️ Watch out: a pass only proves the file exists. It does not prove the video is good, so it still needs a review.
</aside>