{"record":{"id":"d8d15efcdf2d2e41","repo":"Fission-AI/OpenSpec","slug":"missing-required-option-change-available-change","errorCode":null,"errorMessage":"Missing required option --change. Available changes:\n  ${available.join('\\n  ')}","messagePattern":"Missing required option --change\\. Available changes:\n  (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/commands/workflow/shared.ts","lineNumber":199,"sourceCode":" * Validates that a change exists and returns available changes if not.\n * Checks directory existence directly to support scaffolded changes (without proposal.md).\n */\nexport async function validateChangeExists(\n  changeName: string | undefined,\n  projectRoot: string,\n  changesDir = path.join(projectRoot, 'openspec', 'changes'),\n  hints: { newChangeHint?: string } = {}\n): Promise<string> {\n  // Hints must stay pasteable: callers with a selected store pass a\n  // store-carrying hint so following it lands in the same root.\n  const newChangeHint = hints.newChangeHint ?? 'openspec new change <name>';\n\n  if (!changeName) {\n    const available = await getAvailableChanges(projectRoot, changesDir);\n    if (available.length === 0) {\n      throw new Error(`No changes found. Create one with: ${newChangeHint}`);\n    }\n    throw new Error(\n      `Missing required option --change. Available changes:\\n  ${available.join('\\n  ')}`\n    );\n  }\n\n  // Validate change name format to prevent path traversal\n  const lookupError = validateChangeLookupName(changeName);\n  if (lookupError) {\n    throw new Error(`Invalid change name '${changeName}': ${lookupError}`);\n  }\n\n  // Check directory existence directly\n  const changePath = path.join(changesDir, changeName);\n  const exists = fs.existsSync(changePath) && fs.statSync(changePath).isDirectory();\n\n  if (!exists) {\n    const available = await getAvailableChanges(projectRoot, changesDir);\n    if (available.length === 0) {\n      throw new Error(","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/commands/workflow/shared.ts#L181-L217","documentation":"Error \"Missing required option --change. Available changes:\n  ${available.join('\\n  ')}\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/commands/workflow/shared.ts:199 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"}