deepseek-ai/deepseek-harness · error · Error

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

Error message

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

What it means

Error "tool-str-replace-editor: the mounted filesystem confines but ctx.sandboxPolicy is missing" thrown in deepseek-ai/deepseek-harness.

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)

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.