{"record":{"id":"776b66d412537e07","repo":"Fission-AI/OpenSpec","slug":"context-file-exists","errorCode":"context_file_exists","errorMessage":"Refusing to overwrite ${resolved}.","messagePattern":"Refusing to overwrite (.+?)\\.","errorType":"exception","errorClass":"StoreError","httpStatus":null,"severity":"error","filePath":"src/commands/context.ts","lineNumber":127,"sourceCode":"      }\n    }\n    for (const diagnostic of workingSet.status) {\n      console.log(`  Note: ${diagnostic.message}`);\n      if (diagnostic.fix) {\n        console.log(`  Fix: ${diagnostic.fix}`);\n      }\n    }\n  }\n}\n\nfunction writeCodeWorkspace(\n  workingSet: WorkingSet,\n  outputPath: string,\n  force: boolean\n): void {\n  const resolved = path.resolve(outputPath);\n  if (fs.existsSync(resolved) && !force) {\n    throw new StoreError(\n      `Refusing to overwrite ${resolved}.`,\n      'context_file_exists',\n      {\n        target: 'context.output',\n        fix: `Pass --force to overwrite, or choose a different path.`,\n      }\n    );\n  }\n  const parent = path.dirname(resolved);\n  if (!fs.existsSync(parent)) {\n    throw new StoreError(\n      `Output directory does not exist: ${parent}.`,\n      'context_output_dir_missing',\n      { target: 'context.output', fix: 'Create the directory first, or choose another path.' }\n    );\n  }\n\n  const rootName = workingSet.root.store_id ?? path.basename(workingSet.root.path);","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/commands/context.ts#L109-L145","documentation":"Error \"Refusing to overwrite ${resolved}.\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/commands/context.ts:127 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":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-08-25T16:17:27.014Z"}