deepseek-ai/deepseek-harness · error · TypeError
tools/post-execute cannot replace the value of a failed…
Error message
tools/post-execute cannot replace the value of a failed result
What it means
Decision validation in postExecute: an accept decision tries to replace the `value` of a result that already failed (isError). A failed tool result has no success value to replace; listeners may only block or adjust the content of failures.
Solutions
- Gate value replacement on !result.isError in the listener
- Use a block decision with feedback to change a failed result's presentation
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/core/tools/src/index.ts:1766 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of deepseek-ai/deepseek-harness@b150a551b8 (2026-08-24).
Data as JSON: /api/errors/bbe0162c92e97dd9.
Report an issue: GitHub.
Appendix: source
Thrown at packages/core/tools/src/index.ts:1766
if (decision.kind === 'block') {
const message = failureMessageFromContent(decision.feedback)
return this.markCanonical(exec, {
content: decision.feedback,
isError: true,
error: { message },
...decisionContexts.length > 0 ? { additionalContexts: decisionContexts } : {},
})
}
if (Object.hasOwn(decision, 'content') && Object.hasOwn(decision, 'value')) {
throw new TypeError('tools/post-execute accept decision cannot replace both value and content')
}
const additionalContexts = [
...result.additionalContexts ?? [],
...decisionContexts,
]
if (Object.hasOwn(decision, 'value')) {
if (result.isError) {
throw new TypeError('tools/post-execute cannot replace the value of a failed result')
}
const tool = this.resolveExecution(exec.name, exec.agent, exec.parent !== undefined)
if (tool === undefined) throw new ToolNotFoundError(exec.name)
const replaced = this.createSuccessResult(exec, tool, decision.value)
return this.markCanonical(exec, {
...replaced,
...additionalContexts.length > 0 ? { additionalContexts } : {},
})
}
return this.markCanonical(exec, {
...result,
...decision.content !== undefined ? { content: decision.content } : {},
...additionalContexts.length > 0 ? { additionalContexts } : {},
})
}
/** Registry-normalized results and the exact dispatch that validated each value. */
private readonly canonicalResults = new WeakMap<object, ToolExecutionToken>()View on GitHub (pinned to b150a551b8)