{"record":{"id":"a7f27a8e02a8a229","repo":"nexu-io/open-design","slug":"target-must-be-new-project-or-reuse-projecti","errorCode":null,"errorMessage":"--target must be \"new-project\" or \"reuse=<projectId>\" (got \"${value}\")","messagePattern":"--target must be \"new-project\" or \"reuse=<projectId>\" \\(got \"(.+?)\"\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/cli.ts","lineNumber":10568,"sourceCode":"    value === 'new-project' ||\n    value === 'create-each-run' ||\n    value === 'create_each_run'\n  ) {\n    return { mode: 'create_each_run' };\n  }\n  if (value === 'reuse') {\n    if (!flags.project) {\n      throw new Error('--target reuse needs --project <id>');\n    }\n    return { mode: 'reuse', projectId: String(flags.project) };\n  }\n  const eq = value.indexOf('=');\n  if ((value.startsWith('reuse=') || value.startsWith('reuse:')) && eq > 0) {\n    const projectId = value.slice(eq + 1).trim();\n    if (!projectId) throw new Error('--target reuse=<projectId> needs a non-empty id');\n    return { mode: 'reuse', projectId };\n  }\n  throw new Error(\n    `--target must be \"new-project\" or \"reuse=<projectId>\" (got \"${value}\")`,\n  );\n}\n\nfunction describeAutomationScheduleForCli(schedule) {\n  if (!schedule) return '-';\n  if (schedule.kind === 'hourly') {\n    return `hourly:${String(schedule.minute).padStart(2, '0')}`;\n  }\n  if (schedule.kind === 'weekly') {\n    const days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];\n    return `weekly:${days[schedule.weekday] ?? schedule.weekday}:${schedule.time}:${schedule.timezone}`;\n  }\n  return `${schedule.kind}:${schedule.time}:${schedule.timezone}`;\n}\n\nfunction describeAutomationTargetForCli(target) {\n  if (!target) return '-';","sourceCodeStart":10550,"sourceCodeEnd":10586,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/cli.ts#L10550-L10586","documentation":"Thrown by parseAutomationTarget when the `--target` value is not one of the recognized literals (`worktree`, `new-project`, `create-each-run`, `create_each_run`, `reuse`, or `reuse=`/`reuse:<id>`). This is the fall-through for any unrecognized target string, with the bad value echoed back.","triggerScenarios":"Running `--target fork`, `--target existing`, `--target clone`, or any typo such as `--target new-projet`. Also triggered by passing a project id bare like `--target proj_123` instead of `reuse=proj_123`.","commonSituations":"Using an older/newer flag vocabulary the parser no longer accepts, misspelling a mode, or forgetting the `reuse=` prefix when reusing a project.","solutions":["Use `--target new-project` (or `create-each-run`) to make a fresh project each run.","Use `--target reuse=<projectId>` (or `reuse:<projectId>`) to reuse an existing project.","If you only want a default, omit `--target` entirely."],"exampleFix":"// before\n--target proj_123\n// after\n--target reuse=proj_123","handlingStrategy":"validation","validationCode":"const TARGET_MODES = new Set(['worktree','new-project','create-each-run','create_each_run','reuse']);\nfunction isAcceptedTargetValue(value: string): boolean {\n  return TARGET_MODES.has(value) || value.startsWith('reuse=') || value.startsWith('reuse:');\n}","typeGuard":null,"tryCatchPattern":"try {\n  parseAutomationTarget(flags);\n} catch (err) {\n  if (err instanceof Error && /--target must be/.test(err.message)) {\n    // show accepted modes; default to create-each-run\n  }\n  throw err;\n}","preventionTips":["Whitelist the target value before constructing the command.","Remember a bare project id is not valid — wrap it as `reuse=<id>`."],"tags":["cli","validation","automation","flag-parsing"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}