Skip to content

bug: spawn delete shows misleading 'create a spawn first' hint when active servers exist but no filter matches #2454

@la14-1

Description

@la14-1

Summary

In packages/cli/src/commands/delete.ts (lines 226-237), when spawn delete is run with an agent/cloud filter and active servers exist but none match, the error message incorrectly says:

No active servers to delete.
3 active servers found, but none matched your filters.
Run spawn <agent> <cloud> to create a spawn first.

The third line is wrong — the user has active servers, they just need to adjust/remove the filter. The "create a spawn first" message was written for the zero-servers case but is also shown in the unmatched-filter case.

Expected Behavior

When servers exist but none match the filter:

No active servers to delete.
3 active servers found, but none matched your filters.
Run spawn delete without filters to see all servers.

When no servers exist at all:

No active servers to delete.
Run spawn <agent> <cloud> to create a spawn first.

Fix

In packages/cli/src/commands/delete.ts, split the guidance message based on whether servers.length > 0:

if (filtered.length === 0) {
  p.log.info("No active servers to delete.");
  if (servers.length > 0) {
    p.log.info(pc.dim(`... found, but none matched your filters.`));
    p.log.info(`Run ${pc.cyan("spawn delete")} without filters to see all servers.`);
  } else {
    p.log.info(`Run ${pc.cyan("spawn <agent> <cloud>")} to create a spawn first.`);
  }
  return;
}

3-line change + patch version bump.

Found by: refactor/ux-engineer

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingin-progressIssue is being actively worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions