Hmbown/CodeWhale · error · RuntimeError
Codewhale successful run contained an error event
Error message
Codewhale successful run contained an error event
What it means
Even when the process exits 0, the harness counts event types in the stream and rejects the rollout if any 'error' events were emitted. A successful exit with error events means the binary swallowed failures (e.g. tool errors, provider errors) internally, so the run is not treated as a clean rollout.
Solutions
- Inspect receipt['events']['error'] and the full stream output for the error category details
- Check the interception endpoint/network stability and retry the rollout
- Fix the underlying tool/MCP failure the error events report; verify MCP server URLs are reachable
- If errors are expected for the task, capture them via trace info rather than relying on a clean receipt
Defensive patterns
Strategy: try-catch
Try / catch
try:
result = await harness.launch(ctx, trace, runtime, endpoint, secret, mcp_urls)
except RuntimeError as e:
if "contained an error event" in str(e):
receipt = trace.info.get("codewhale", {})
# inspect receipt['events']['error'] and raw stream for the failing category
...
else:
raise Prevention
- Monitor receipt['events'] error counts across rollouts to catch flaky providers/tools
- Ensure MCP server URLs are reachable from the runtime
- Treat exit code 0 as insufficient; always review the stream receipt
When it happens
Trigger: The Codewhale run emitted one or more stream-json events of type 'error' but still terminated with exit code 0 and a resolved/completed terminal receipt, during launch().
Common situations: Transient provider/API errors retried internally; sandbox_denied or MCP tool failures logged as error events; flaky network to the interception endpoint.
Understand the failure class
Background: "invalid response format", "malformed payload", "missing data field": when an API returns 200 but the response shape is wrong — this error's family across 23 libraries.
Related errors
- Codewhale terminal receipt did not confirm auto tools
- Codewhale terminal receipt did not use provider openai
- Codewhale terminal receipt model did not match rollout
- Codewhale terminal receipt sandbox did not match launch
- Codewhale stream-json line
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/9c34dbec26cf466b.
Report an issue: GitHub.
Appendix: source
Thrown at integrations/verifiers-codewhale/codewhale_harness/harness.py:236
argv.extend(["--disallowed-tools", ",".join(self.config.disabled_tools)])
if system:
argv.extend(["--append-system-prompt", system])
argv.extend(["--", str(prompt or "")])
result = await runtime.run_program(argv, env)
if result.exit_code == 0:
receipt = _parse_stream_receipt(result.stdout)
terminal = receipt["terminal"]
if terminal.get("provider") != "openai":
raise RuntimeError("Codewhale terminal receipt did not use provider openai")
if terminal.get("model") != ctx.model:
raise RuntimeError("Codewhale terminal receipt model did not match rollout")
if terminal.get("approval_posture") != "auto_tools":
raise RuntimeError("Codewhale terminal receipt did not confirm auto tools")
if terminal.get("sandbox_posture") != sandbox:
raise RuntimeError("Codewhale terminal receipt sandbox did not match launch")
if receipt["events"].get("error", 0) != 0:
raise RuntimeError("Codewhale successful run contained an error event")
if terminal.get("status") != "completed":
raise RuntimeError("Codewhale terminal receipt did not report completion")
if terminal.get("termination_reason") != "resolved":
raise RuntimeError("Codewhale terminal receipt was not resolved")
trace.info["codewhale"] = receipt
return result
def _has_version(output: str, version: str) -> bool:
return (
re.search(
rf"(?<![0-9A-Za-z.+-]){re.escape(version)}(?![0-9A-Za-z.+-])",
output,
)
is not None
)
View on GitHub (pinned to 433685b202)