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

  1. Use `--target new-project` (or `create-each-run`) to make a fresh project each run.
  2. Use `--target reuse=<projectId>` (or `reuse:<projectId>`) to reuse an existing project.
  3. 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

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


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