nexu-io/open-design · error · Error
--target reuse=<projectId> needs a non-empty id
Error message
--target reuse=<projectId> needs a non-empty id
What it means
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.
Source
Thrown at apps/daemon/src/cli.ts:10565
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')}`;
}
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}`;
}View on GitHub (pinned to 5be4028344)
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.
Example fix
// before --target reuse=$PROJECT_ID # PROJECT_ID unset // after PROJECT_ID=proj_123; --target reuse=$PROJECT_ID
Defensive patterns
Strategy: validation
Validate before calling
function reuseInlineHasId(value: string): boolean {
if (!(value.startsWith('reuse=') || value.startsWith('reuse:'))) return true;
const eq = value.indexOf(value.startsWith('reuse:') ? ':' : '=');
return value.slice(eq + 1).trim().length > 0;
} Try / catch
try {
parseAutomationTarget(flags);
} catch (err) {
if (err instanceof Error && /reuse=<projectId> needs a non-empty id/.test(err.message)) {
// re-read the project id source and rebuild the flag
}
throw err;
} Prevention
- 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.
When it happens
Trigger: Running `--target reuse=` or `--target reuse:` (nothing after the separator), or `--target reuse= ` (only whitespace).
Common situations: A shell/scripting mistake where the project id variable expanded to empty, e.g. `--target reuse=$PROJECT_ID` with PROJECT_ID unset.
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/6d29abda83fe2402.
Report an issue: GitHub.