{"record":{"id":"5c2d97d624c23130","repo":"deepseek-ai/deepseek-harness","slug":"tool-str-replace-editor-the-mounted-filesystem-co","errorCode":null,"errorMessage":"tool-str-replace-editor: the mounted filesystem confines but ctx.sandboxPolicy is missing","messagePattern":"tool-str-replace-editor: the mounted filesystem confines but ctx\\.sandboxPolicy is missing","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/fs/tool-str-replace-editor/src/index.ts","lineNumber":71,"sourceCode":"function lineNumbersAt(content: string, offsets: readonly number[]): number[] {\n  let line = 1\n  let cursor = 0\n  return offsets.map((offset) => {\n    while (cursor < offset) {\n      if (content[cursor] === '\\n') line += 1\n      cursor += 1\n    }\n    return line\n  })\n}\n\nclass MutationPolicy {\n  private readonly policy: SandboxPolicyService | undefined\n\n  constructor(ctx: Context) {\n    this.policy = ctx.fs.sandboxMode === undefined ? undefined : ctx.get('sandboxPolicy')\n    if (ctx.fs.sandboxMode !== undefined && this.policy === undefined) {\n      throw new Error('tool-str-replace-editor: the mounted filesystem confines but ctx.sandboxPolicy is missing')\n    }\n  }\n\n  resolve(exec: ToolRunContext): SandboxExecutionPolicy | undefined {\n    return this.policy?.resolve({\n      ...exec.agent === undefined ? {} : { session: exec.agent.session },\n    })\n  }\n\n  mapError(error: unknown, policy: SandboxExecutionPolicy | undefined): unknown {\n    if (!(error instanceof FsError) || error.code !== 'FS_SANDBOX_DENIED') return error\n    const mode = (policy as SandboxExecutionPolicy).mode\n    return new FsError(sandboxDenialMarker(mode), 'FS_SANDBOX_DENIED', { cause: error })\n  }\n}\n\nasync function resolveTarget(\n  ctx: Context,","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/fs/tool-str-replace-editor/src/index.ts#L53-L89","documentation":"Error \"tool-str-replace-editor: the mounted filesystem confines but ctx.sandboxPolicy is missing\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/fs/tool-str-replace-editor/src/index.ts:71 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"}