{"record":{"id":"0503188821119f9e","repo":"deepseek-ai/deepseek-harness","slug":"agent-presets-preset-presetid-already-exists","errorCode":null,"errorMessage":"agent-presets: preset \"${presetId}\" already exists — a copy never overwrites; delete the existing preset first or choose another id","messagePattern":"agent-presets: preset \"(.+?)\" already exists — a copy never overwrites; delete the existing preset first or choose another id","errorType":"exception","errorClass":"PresetExistsError","httpStatus":null,"severity":"error","filePath":"packages/preset/agent-presets/src/authoring.ts","lineNumber":147,"sourceCode":" * @param source - the resolved preset the copy starts from.\n * @param id - the new preset's id, which becomes its directory name.\n * @param name - display name for the copy; omitted falls back to the id.\n * @returns the absolute path of the new preset directory.\n * @throws when the id is unusable or already occupied on disk, or the\n * deployment configures no writable root.\n */\nexport async function copyComposition(\n  roots: readonly PresetRoot[],\n  source: AgentPreset,\n  id: string,\n  name?: string,\n): Promise<string> {\n  if (!PRESET_ID.test(id)) throw new InvalidPresetIdError(id)\n  const dir = join(writableRoot(roots), id)\n  // The roster check upstream only sees discovered presets; a directory with\n  // no composition file still occupies the name and deserves a readable\n  // refusal rather than a filesystem error code.\n  if (await occupied(dir)) throw new PresetExistsError(id)\n  try {\n    await cp(dirname(source.path), dir, {\n      recursive: true, dereference: true, force: false, errorOnExist: true,\n    })\n    await tightenModes(dir)\n    const rendered = renderPresetMetadata({\n      ...name === undefined ? {} : { name },\n      ...source.description === undefined ? {} : { description: source.description },\n    })\n    const metadataPath = join(dir, METADATA_FILE)\n    if (rendered === undefined) {\n      await rm(metadataPath, { force: true })\n    } else {\n      await writeFileAtomic(metadataPath, rendered, { mode: 0o600, dirMode: 0o700 })\n    }\n  } catch (error) {\n    // A half-copied directory would be invisible to discovery at best and a\n    // mountable-but-incomplete preset at worst; a failed copy leaves nothing.","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/deepseek-ai/deepseek-harness/blob/b150a551b8d465e31e418e1b2eaf5e79bbb7d28e/packages/preset/agent-presets/src/authoring.ts#L129-L165","documentation":"Error \"agent-presets: preset \"${presetId}\" already exists — a copy never overwrites; delete the existing preset first or choose another id\" thrown in deepseek-ai/deepseek-harness.","triggerScenarios":"Thrown at packages/preset/agent-presets/src/authoring.ts:147 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete the existing preset first, or choose another id."],"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"}