can1357/oh-my-pi · error · ToolError
${error.message} (rethrown as ToolError from StructuredSubag
Error message
${error.message} (rethrown as ToolError from StructuredSubagentError) What it means
At the end of runEvalAgent, any StructuredSubagentError escaping the execution block is rethrown as a ToolError carrying the original message plus a marker noting its origin, so eval tooling sees a consistent tool-error type. The marker distinguishes these from ordinary ToolErrors thrown earlier in the bridge.
Source
Thrown at packages/coding-agent/src/eval/agent-bridge.ts:221
text,
...(hasData ? { data } : {}),
details: {
agent: result.agent,
id: result.id,
...(model !== undefined ? { model } : {}),
structured,
...(schemaSource !== undefined ? { schemaSource } : {}),
...(schemaMode !== undefined ? { schemaMode } : {}),
...(schemaStatus !== undefined ? { schemaStatus } : {}),
...(policy.isIsolated ? { isolated: true, changesApplied } : {}),
...(result.patchPath !== undefined ? { patchPath: result.patchPath } : {}),
...(result.branchName !== undefined ? { branchName: result.branchName } : {}),
...(nestedPatches !== undefined ? { nestedPatches } : {}),
...(isolationSummary !== undefined ? { isolationSummary } : {}),
},
};
} catch (error) {
if (error instanceof StructuredSubagentError) throw new ToolError(error.message);
throw error;
}
}
View on GitHub (pinned to 9690622007)
Solutions
- Act on error.message — it is the original StructuredSubagentError text
- Check artifacts/recovery info from the correlated run
- Update the eval harness and subagent runtime to matching versions
- If reproducible, file a bug with the message and eval cell
Example fix
// before: raw internal error leaks to eval
} catch (e) { throw e }
// after: bridge already normalizes; handle the ToolError
try { await runEvalAgent(args, opts) } catch (e) { if (e instanceof ToolError) report(e.message) } Defensive patterns
Strategy: try-catch
Validate before calling
null
Type guard
null
Try / catch
try { await runEvalAgent(args, opts) } catch (e) { if (/rethrown as ToolError from StructuredSubagentError/.test(e.message)) { handleStructuredSubagentFailure(e.message); } else throw e } Prevention
- Keep eval harness and subagent runtime versions aligned
- Validate structured output schemas in the subagent
- Log the message verbatim — it carries the root cause
- Add an eval-cell regression test after any occurrence
When it happens
Trigger: Any failure inside the isolated-subagent execution pipeline that raises StructuredSubagentError (structured-output collection, nested patch handling, merge bookkeeping) propagates to this catch and is converted.
Common situations: Subagent produced structured output in an unexpected shape; nested-patch pipeline failed below the earlier explicit checks; version drift between the eval harness and subagent runtime changed error classes.
Related errors
- agent() blocked: turn token budget exhausted (${turnBudget.s
- ${failureMessage}${recoveryHint} (subagent failure: ${policy
- agent() isolated apply failed for ${result.id}${summary ? `:
- agent() isolated nested patch apply failed for ${result.id}:
- This task requires structured output matching the declared s
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/8f5c027a04f04dfa.
Report an issue: GitHub.