deepseek-ai/deepseek-harness · error · Error
tools.presentAs("${mode}") conflicts with "${layer.mode}" al
Error message
tools.presentAs("${mode}") conflicts with "${layer.mode}" already declared for this scope; one composition selects one presentation What it means
Error "tools.presentAs("${mode}") conflicts with "${layer.mode}" already declared for this scope; one composition selects one presentation" thrown in deepseek-ai/deepseek-harness.
Source
Thrown at packages/core/tools/src/index.ts:956
* declaration covers every agent joined under it.
*
* Scoped only, and one declaration per scope: this is how an agent preset
* composes Code Mode agents beside native ones in the same process, and a
* process-global override would be the `mode` config field instead.
* @param mode - the presentation the covered agents' models see.
* @returns the exact disposer that restores the deployment default.
*/
presentAs(mode: ToolPresentationMode): () => void {
const ctx = this.ctx
if (scopeOf(ctx) === undefined) {
throw new Error('tools.presentAs() requires a scoped context (agent.ctx): a context-global presentation is the `mode` config field on the tools row')
}
const dispose = ctx.effect(function* (this: ToolRuntime) {
yield this.layers.effect(
ctx,
(layer) => {
if (layer.mode !== undefined) {
throw new Error(`tools.presentAs("${mode}") conflicts with "${layer.mode}" already declared for this scope; one composition selects one presentation`)
}
layer.mode = mode
return () => { layer.mode = undefined }
},
{ label: 'tools.presentAs()' },
)
// The SDK and collapse sections are per scope for the same reason the
// mode is. Under a deployment that already defaults to a code mode this
// shadows the global registration with an identical body, which costs
// nothing and keeps one rule instead of a case analysis.
if (mode !== 'native') {
yield ctx.systemPrompt.section(this.collapseSection())
yield ctx.systemPrompt.section(this.sdkSection())
}
}.bind(this), 'tools.presentAs()')
// oxlint-disable-next-line typescript/no-misused-promises -- synchronous composite teardown; direct return preserves disposer identity
return dispose
}View on GitHub (pinned to b150a551b8)
When it happens
Trigger: Thrown at packages/core/tools/src/index.ts:956 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/715b8f7cd729544c.
Report an issue: GitHub.