deepseek-ai/deepseek-harness · error · PresetNotWritableError

agent-presets: preset

Error message

agent-presets: preset "${presetId}" cannot be written: it does not live under the writable preset root

What it means

Guard in deleteComposition(): although the preset is user-trust, its directory lies outside the writable preset root (path escape or stale root config). Deletion is confined to directories actually under the writable root.

Solutions

  1. Write only presets that live under the writable preset root.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/preset/agent-presets/src/authoring.ts:193 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/c94a7ad9481a6372. Report an issue: GitHub.

Appendix: source

Thrown at packages/preset/agent-presets/src/authoring.ts:193

 * A shipped preset is refused: it belongs to the deployment. A preset a live
 * session mounted is NOT refused — the composition was read at creation and is
 * never re-read, so that session keeps running exactly as it was.
 * @param roots - the configured roots.
 * @param preset - the resolved preset to remove.
 * @throws when the preset ships with the deployment or lies outside the writable root.
 */
export async function deleteComposition(
  roots: readonly PresetRoot[],
  preset: AgentPreset,
): Promise<void> {
  if (preset.trust !== 'user') {
    throw new PresetNotWritableError(preset.id, 'it ships with the deployment')
  }
  const dir = join(writableRoot(roots), preset.id)
  // Belt and braces over the id pattern: the resolved directory must still be
  // the one the writable root owns, whatever discovery reported.
  if (!isAbsolute(preset.path) || !preset.path.startsWith(dir)) {
    throw new PresetNotWritableError(preset.id, 'it does not live under the writable preset root')
  }
  await rm(dir, { recursive: true, force: true })
}

View on GitHub (pinned to b150a551b8)