nexu-io/open-design · error · Error
--target reuse needs --project <id>
Error message
--target reuse needs --project <id>
What it means
Thrown by parseAutomationTarget when `--target reuse` is given but no `--project <id>` flag accompanies it. The `reuse` mode requires a target project id to reuse; without one the parser cannot form a valid reuse target. Note the bare word `reuse` (not `reuse=...`) specifically depends on the separate `--project` flag.
Source
Thrown at apps/daemon/src/cli.ts:10558
function parseAutomationTarget(flags) {
const raw = flags.target;
if (raw == null) {
if (flags.project) return { mode: 'reuse', projectId: String(flags.project) };
return { mode: 'create_each_run' };
}
const value = String(raw);
if (
value === 'worktree' ||
value === 'new-project' ||
value === 'create-each-run' ||
value === 'create_each_run'
) {
return { mode: 'create_each_run' };
}
if (value === 'reuse') {
if (!flags.project) {
throw new Error('--target reuse needs --project <id>');
}
return { mode: 'reuse', projectId: String(flags.project) };
}
const eq = value.indexOf('=');
if ((value.startsWith('reuse=') || value.startsWith('reuse:')) && eq > 0) {
const projectId = value.slice(eq + 1).trim();
if (!projectId) throw new Error('--target reuse=<projectId> needs a non-empty id');
return { mode: 'reuse', projectId };
}
throw new Error(
`--target must be "new-project" or "reuse=<projectId>" (got "${value}")`,
);
}
function describeAutomationScheduleForCli(schedule) {
if (!schedule) return '-';
if (schedule.kind === 'hourly') {
return `hourly:${String(schedule.minute).padStart(2, '0')}`;View on GitHub (pinned to 5be4028344)
Solutions
- Add the project id: `--target reuse --project <projectId>`.
- Or switch to the inline form: `--target reuse=<projectId>`.
- Verify the project id is non-empty and is a project you can access.
Example fix
// before od automation create --target reuse // after od automation create --target reuse=proj_123 // or od automation create --target reuse --project proj_123
Defensive patterns
Strategy: validation
Validate before calling
// Before calling parseAutomationTarget, ensure 'reuse' carries a project id.
function reuseTargetIsComplete(flags: { target?: unknown; project?: unknown }): boolean {
if (flags.target !== 'reuse') return true;
return Boolean(flags.project && String(flags.project).trim());
} Try / catch
try {
parseAutomationTarget(flags);
} catch (err) {
if (err instanceof Error && /--target reuse needs --project/.test(err.message)) {
// prompt for a project id, or fall back to create-each-run
}
throw err;
} Prevention
- Prefer the inline `reuse=<projectId>` form to keep the id next to the mode.
- When scripting, default to omitting --target (create-each-run) unless reuse is intentional.
When it happens
Trigger: Running `od automation create --target reuse` without also passing `--project <id>`, or passing `--project` with an empty value.
Common situations: Confusing the two reuse forms: `--target reuse` (needs `--project`) versus `--target reuse=<id>` (carries the id inline). Forgetting the project id when scripting.
Related errors
- --schedule ${kind} time must be HH:MM (24h)
- --schedule weekly requires :DAY:HH:MM[:TZ] (DAY is 0-6 or su
- --schedule weekly day must be 0-6 or sun..sat (got "${parts[
- --schedule weekly time must be HH:MM (24h)
- --schedule kind must be hourly|daily|weekdays|weekly (got "$
AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12).
Data as JSON: /api/errors/58c2846af74d0afe.
Report an issue: GitHub.