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

  1. Supply a non-empty project id after the separator: `--target reuse=proj_123`.
  2. Check that the id-providing shell variable is set and non-empty before constructing the flag.
  3. 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 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


AI-assisted analysis of nexu-io/open-design@5be4028344 (2026-08-12). Data as JSON: /api/errors/6d29abda83fe2402. Report an issue: GitHub.