deepseek-ai/deepseek-harness · error · Error

tool-str-replace-editor: the mounted filesystem confines…

Error message

tool-str-replace-editor: the mounted filesystem confines but ctx.sandboxPolicy is missing

What it means

Composition-time guard in MutationPolicy's constructor: ctx.fs reports a confining sandbox mode, so a sandbox policy service is required to resolve execution policies, but ctx.get('sandboxPolicy') returned undefined. The plugin refuses to register mutations it cannot confine; this is a wiring fault, not a runtime input error.

Solutions

  1. Mount the sandboxPolicy service alongside the confining filesystem in cordis.yml
  2. Fix the plugin load order so sandboxPolicy registers before tool-str-replace-editor
  3. File a bug against the profile if both plugins are already declared together
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/fs/tool-str-replace-editor/src/index.ts:71 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/5c2d97d624c23130. Report an issue: GitHub.

Appendix: source

Thrown at packages/fs/tool-str-replace-editor/src/index.ts:71

function lineNumbersAt(content: string, offsets: readonly number[]): number[] {
  let line = 1
  let cursor = 0
  return offsets.map((offset) => {
    while (cursor < offset) {
      if (content[cursor] === '\n') line += 1
      cursor += 1
    }
    return line
  })
}

class MutationPolicy {
  private readonly policy: SandboxPolicyService | undefined

  constructor(ctx: Context) {
    this.policy = ctx.fs.sandboxMode === undefined ? undefined : ctx.get('sandboxPolicy')
    if (ctx.fs.sandboxMode !== undefined && this.policy === undefined) {
      throw new Error('tool-str-replace-editor: the mounted filesystem confines but ctx.sandboxPolicy is missing')
    }
  }

  resolve(exec: ToolRunContext): SandboxExecutionPolicy | undefined {
    return this.policy?.resolve({
      ...exec.agent === undefined ? {} : { session: exec.agent.session },
    })
  }

  mapError(error: unknown, policy: SandboxExecutionPolicy | undefined): unknown {
    if (!(error instanceof FsError) || error.code !== 'FS_SANDBOX_DENIED') return error
    const mode = (policy as SandboxExecutionPolicy).mode
    return new FsError(sandboxDenialMarker(mode), 'FS_SANDBOX_DENIED', { cause: error })
  }
}

async function resolveTarget(
  ctx: Context,

View on GitHub (pinned to b150a551b8)