nexu-io/open-design · error · Error
--target must be "new-project" or "reuse=<projectId>" (got "
Error message
--target must be "new-project" or "reuse=<projectId>" (got "${value}") What it means
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.
Source
Thrown at apps/daemon/src/cli.ts:10568
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')}`;
}
if (schedule.kind === 'weekly') {
const days = ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'];
return `weekly:${days[schedule.weekday] ?? schedule.weekday}:${schedule.time}:${schedule.timezone}`;
}
return `${schedule.kind}:${schedule.time}:${schedule.timezone}`;
}
function describeAutomationTargetForCli(target) {
if (!target) return '-';View on GitHub (pinned to 5be4028344)
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.
Example fix
// before --target proj_123 // after --target reuse=proj_123
Defensive patterns
Strategy: validation
Validate before calling
const TARGET_MODES = new Set(['worktree','new-project','create-each-run','create_each_run','reuse']);
function isAcceptedTargetValue(value: string): boolean {
return TARGET_MODES.has(value) || value.startsWith('reuse=') || value.startsWith('reuse:');
} Try / catch
try {
parseAutomationTarget(flags);
} catch (err) {
if (err instanceof Error && /--target must be/.test(err.message)) {
// show accepted modes; default to create-each-run
}
throw err;
} Prevention
- Whitelist the target value before constructing the command.
- Remember a bare project id is not valid — wrap it as `reuse=<id>`.
When it happens
Trigger: 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`.
Common situations: Using an older/newer flag vocabulary the parser no longer accepts, misspelling a mode, or forgetting the `reuse=` prefix when reusing a project.
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/a7f27a8e02a8a229.
Report an issue: GitHub.