error_during_execution - no debugging information as to why

Resolved 💬 6 comments Opened Aug 19, 2025 by johnwest80 Closed Sep 2, 2025

So I have a job that runs, and periodically fails with a mysterious "error_during_execution" result subtype.

    echo "$FULL_PROMPT" | npx @anthropic-ai/claude-code -p --verbose --output-format json --allowedTools "Bash(echo:*)" "Bash(find:*)" > "$TEMP_FILE"

the prompt is mostly the same between runs. and more importantly, the output shows that all todos completed successfully. i didn't include all of the output below, but every step worked. it's only at the very end, after all todos are complete, that it bombs with an error_during_execution subtype for the result. there's no other information to help troubleshoot what could be happening.

this is not consistent. i can run it again with the same input, and it works fine. and it's only about one out of every 10 runs that this error occurs.

i can't find a single instance of "error_during_execution" when i search for that string on google. i'm reporting this because i'd really just like to know what i can do to debug this myself. maybe i'm missing something will tell me why this sporadically fails?

...
  {
    "type": "assistant",
    "message": {
      "id": "masked",
      "type": "message",
      "role": "assistant",
      "model": "claude-3-7-sonnet-20250219",
      "content": [
        {
          "type": "tool_use",
          "id": "masked",
          "name": "TodoWrite",
          "input": {
            "todos": [
              {
                "content": "Read PR details",
                "status": "completed",
                "id": "1"
              },
              { "content": "Read PR diff", "status": "completed", "id": "2" },
              {
                "content": "Read PR changes",
                "status": "completed",
                "id": "3"
              },
              {
                "content": "Read individual file diffs",
                "status": "completed",
                "id": "4"
              },
              {
                "content": "Generate summary of changes",
                "status": "completed",
                "id": "5"
              },
              {
                "content": "Identify issues from enumerated list",
                "status": "completed",
                "id": "6"
              },
              {
                "content": "Identify behavior without test coverage",
                "status": "completed",
                "id": "7"
              },
              {
                "content": "Perform code review",
                "status": "completed",
                "id": "8"
              },
              {
                "content": "Perform security review",
                "status": "completed",
                "id": "9"
              },
              {
                "content": "Compile final report",
                "status": "completed",
                "id": "10"
              }
            ]
          }
        }
      ],
      "stop_reason": null,
      "stop_sequence": null,
      "usage": {
        "input_tokens": 3,
        "cache_creation_input_tokens": 438,
        "cache_read_input_tokens": 30510,
        "output_tokens": 733
      }
    },
    "parent_tool_use_id": null,
    "session_id": "masked"
  },
  {
    "type": "user",
    "message": {
      "role": "user",
      "content": [
        {
          "tool_use_id": "masked",
          "type": "tool_result",
          "content": "Todos have been modified successfully. Ensure that you continue to use the todo list to track your progress. Please proceed with the current tasks if applicable"
        }
      ]
    },
    "parent_tool_use_id": null,
    "session_id": "masked"
  },
  {
    "type": "result",
    "subtype": "error_during_execution",
    "duration_ms": 145507,
    "duration_api_ms": 147997,
    "is_error": false,
    "num_turns": 0,
    "session_id": "masked",
    "total_cost_usd": 0.28978655000000003,
    "usage": {
      "input_tokens": 72,
      "cache_creation_input_tokens": 13775,
      "cache_read_input_tokens": 499919,
      "output_tokens": 5771,
      "server_tool_use": { "web_search_requests": 0 },
      "service_tier": "standard"
    },
    "permission_denials": []
  }
]

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗