{"record":{"id":"802f8879a3363be3","repo":"deepseek-ai/deepseek-harness","slug":"spill-policy-savetext-failed-for-toolname-s","errorCode":null,"errorMessage":"spill-policy: saveText failed for ${toolName}: ${String(error)}; keeping the inline content","messagePattern":"spill-policy: saveText failed for (.+?): (.+?); keeping the inline content","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/spill/spill-policy/src/index.ts","lineNumber":159,"sourceCode":"    }\n    const spillStore = ctx.get('spillStore')\n    if (!spillStore) {\n      ctx.logger.warn('spill-policy: no ctx.spillStore backend loaded; keeping the inline content')\n      return undefined\n    }\n    const save: SaveTextSpill = {\n      owner: { sessionId },\n      source: { toolName, callId, label },\n      suggestedName: `${toolName}.txt`,\n      content: text,\n    }\n    let ref: SpillRef\n    try {\n      ref = await spillStore.saveText(save)\n    } catch (error: unknown) {\n      // Best-effort: a storage failure (permissions, ENOSPC, backend down) must\n      // never fail the call or hide the content — keep the original inline.\n      ctx.logger.warn(`spill-policy: saveText failed for ${toolName}: ${String(error)}; keeping the inline content`)\n      return undefined\n    }\n\n    // Reserve the notice's byte cost INSIDE maxInlineBytes so the replacement\n    // (preview + blank line + notice) never exceeds the documented cap — a naive\n    // preview that spent the whole budget then appended the notice could be\n    // larger than the cap, and for a marginally-over result even larger than the\n    // original. The reservation uses a notice priced at the worst-case omission\n    // count (the full byte total): its digit count bounds the real count's, so\n    // the reserved size is a safe upper bound and the final notice is never\n    // longer than what we reserved. `\\n\\n` is the 2-byte join.\n    const reserve = Buffer.byteLength(spillNotice({ kind: 'exact', count: totalBytes }, ref), 'utf8') + 2\n    const previewBudget = Math.max(0, cap - reserve)\n    const { text: previewText, omitted } = preview(text, previewBudget)\n    const notice = spillNotice(omitted, ref)\n    const replacedText = previewText.length > 0 ? `${previewText}\\n\\n${notice}` : notice\n    // Invariant: the policy NEVER emits a replacement larger than the cap. When\n    // the notice alone exceeds maxInlineBytes (a tiny cap or a long spill root),","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/spill/spill-policy/src/index.ts#L141-L177","documentation":"Error \"spill-policy: saveText failed for ${toolName}: ${String(error)}; keeping the inline content\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/spill/spill-policy/src/index.ts:159 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the configured spillStore plugin is loaded and writable and that disk space is available; the inline content is kept, so retry after fixing the store."],"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"}