Fission-AI/OpenSpec · error · Error

buildLaunchCommand requires at least one member.

Error message

buildLaunchCommand requires at least one member.

What it means

Pure-argv precondition in buildLaunchCommand: an empty members array was passed. The builder cannot construct a launch command (no workspace members to open or attach), so it throws immediately — callers must filter empty worksets before invoking it.

Solutions

  1. Ensure the workset contains at least one member before building the launch command
  2. Filter or reject empty worksets upstream of the opener
  3. Pass a valid members array to buildLaunchCommand
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/core/openers.ts:338 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Fission-AI/OpenSpec@6926ccb18a (2026-08-25). Data as JSON: /api/errors/4e6b121690a40ad1. Report an issue: GitHub.

Appendix: source

Thrown at src/core/openers.ts:338

  cwd: string;
  label: string;
  style: OpenerStyle;
}

/**
 * Pure argv builder. workspace-file: pre-args + the generated file's
 * absolute path (which also defuses the cursor shim's `agent`
 * first-arg hijack). attach-dirs: pre-args + one attach flag + path
 * pair per surviving member, the primary included (the locked "one
 * attach flag per member"); never a trailing positional - both agent
 * CLIs would read one as a starter prompt, which 7.1 locks out.
 */
export function buildLaunchCommand(
  opener: OpenerDefinition,
  input: { members: WorksetMember[]; codeWorkspacePath: string }
): LaunchCommand {
  if (input.members.length === 0) {
    throw new Error('buildLaunchCommand requires at least one member.');
  }

  // The no-hijack and no-positional guarantees lean on absolute paths
  // (the child resolves relative argv against its own cwd) - keep the
  // invariant local instead of three modules away.
  if (!path.isAbsolute(input.codeWorkspacePath)) {
    throw new Error(
      `buildLaunchCommand requires an absolute workspace-file path (got '${input.codeWorkspacePath}').`
    );
  }

  const cwd = input.members[0].path;

  if (opener.style === 'workspace-file') {
    return {
      executable: opener.command,
      args: [...opener.args, input.codeWorkspacePath],
      cwd,

View on GitHub (pinned to 6926ccb18a)