{"record":{"id":"6d29abda83fe2402","repo":"nexu-io/open-design","slug":"target-reuse-projectid-needs-a-non-empty-id","errorCode":null,"errorMessage":"--target reuse=<projectId> needs a non-empty id","messagePattern":"--target reuse=<projectId> needs a non-empty id","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/cli.ts","lineNumber":10565,"sourceCode":"  const value = String(raw);\n  if (\n    value === 'worktree' ||\n    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}","sourceCodeStart":10547,"sourceCodeEnd":10583,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/cli.ts#L10547-L10583","documentation":"Thrown by parseAutomationTarget when the `--target` value starts with `reuse=` or `reuse:` but the part after the separator is empty after trimming. The inline reuse form must carry a non-empty project id inline; `reuse=` or `reuse:` alone is rejected.","triggerScenarios":"Running `--target reuse=` or `--target reuse:` (nothing after the separator), or `--target reuse=   ` (only whitespace).","commonSituations":"A shell/scripting mistake where the project id variable expanded to empty, e.g. `--target reuse=$PROJECT_ID` with PROJECT_ID unset.","solutions":["Supply a non-empty project id after the separator: `--target reuse=proj_123`.","Check that the id-providing shell variable is set and non-empty before constructing the flag.","If the id is unknown, omit `--target` entirely to use the default create-each-run mode."],"exampleFix":"// before\n--target reuse=$PROJECT_ID   # PROJECT_ID unset\n// after\nPROJECT_ID=proj_123; --target reuse=$PROJECT_ID","handlingStrategy":"validation","validationCode":"function reuseInlineHasId(value: string): boolean {\n  if (!(value.startsWith('reuse=') || value.startsWith('reuse:'))) return true;\n  const eq = value.indexOf(value.startsWith('reuse:') ? ':' : '=');\n  return value.slice(eq + 1).trim().length > 0;\n}","typeGuard":null,"tryCatchPattern":"try {\n  parseAutomationTarget(flags);\n} catch (err) {\n  if (err instanceof Error && /reuse=<projectId> needs a non-empty id/.test(err.message)) {\n    // re-read the project id source and rebuild the flag\n  }\n  throw err;\n}","preventionTips":["When building `--target reuse=$VAR`, assert VAR is set and non-empty first.","Fall back to create-each-run when the id source is unavailable."],"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"}