{"record":{"id":"715b8f7cd729544c","repo":"deepseek-ai/deepseek-harness","slug":"tools-presentas-mode-conflicts-with-layer","errorCode":null,"errorMessage":"tools.presentAs(\"${mode}\") conflicts with \"${layer.mode}\" already declared for this scope; one composition selects one presentation","messagePattern":"tools\\.presentAs\\(\"(.+?)\"\\) conflicts with \"(.+?)\" already declared for this scope; one composition selects one presentation","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/tools/src/index.ts","lineNumber":956,"sourceCode":"   * declaration covers every agent joined under it.\n   *\n   * Scoped only, and one declaration per scope: this is how an agent preset\n   * composes Code Mode agents beside native ones in the same process, and a\n   * process-global override would be the `mode` config field instead.\n   * @param mode - the presentation the covered agents' models see.\n   * @returns the exact disposer that restores the deployment default.\n   */\n  presentAs(mode: ToolPresentationMode): () => void {\n    const ctx = this.ctx\n    if (scopeOf(ctx) === undefined) {\n      throw new Error('tools.presentAs() requires a scoped context (agent.ctx): a context-global presentation is the `mode` config field on the tools row')\n    }\n    const dispose = ctx.effect(function* (this: ToolRuntime) {\n      yield this.layers.effect(\n        ctx,\n        (layer) => {\n          if (layer.mode !== undefined) {\n            throw new Error(`tools.presentAs(\"${mode}\") conflicts with \"${layer.mode}\" already declared for this scope; one composition selects one presentation`)\n          }\n          layer.mode = mode\n          return () => { layer.mode = undefined }\n        },\n        { label: 'tools.presentAs()' },\n      )\n      // The SDK and collapse sections are per scope for the same reason the\n      // mode is. Under a deployment that already defaults to a code mode this\n      // shadows the global registration with an identical body, which costs\n      // nothing and keeps one rule instead of a case analysis.\n      if (mode !== 'native') {\n        yield ctx.systemPrompt.section(this.collapseSection())\n        yield ctx.systemPrompt.section(this.sdkSection())\n      }\n    }.bind(this), 'tools.presentAs()')\n    // oxlint-disable-next-line typescript/no-misused-promises -- synchronous composite teardown; direct return preserves disposer identity\n    return dispose\n  }","sourceCodeStart":938,"sourceCodeEnd":974,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/core/tools/src/index.ts#L938-L974","documentation":"Error \"tools.presentAs(\"${mode}\") conflicts with \"${layer.mode}\" already declared for this scope; one composition selects one presentation\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/core/tools/src/index.ts:956 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b150a551b8d465e31e418e1b2eaf5e79bbb7d28e","analyzedAt":"2026-08-24T18:12:29.105Z","schemaVersion":2},"datasetVersion":"2026-08-24T22:17:12.610Z"}