multica-ai/multica · error

list squads: %w

Error message

list squads: %w

What it means

Returned by `multica squads list` when GET `/api/squads` fails. This is the simplest request in the squad command set — no params, no body — so failure is purely environmental: server unreachable, wrong --api-url, invalid/expired auth, timeout, or a server-side error listing squads.

Source

Thrown at server/cmd/multica/cmd_squad.go:39

var squadListCmd = &cobra.Command{
	Use:   "list",
	Short: "List squads in the workspace",
	Args:  cobra.NoArgs,
	RunE:  runSquadList,
}

func runSquadList(cmd *cobra.Command, _ []string) error {
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}
	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	var squads []map[string]any
	if err := client.GetJSON(ctx, "/api/squads", &squads); err != nil {
		return fmt.Errorf("list squads: %w", err)
	}

	output, _ := cmd.Flags().GetString("output")
	if output == "json" {
		return cli.PrintJSON(os.Stdout, squads)
	}

	if len(squads) == 0 {
		fmt.Fprintln(os.Stderr, "No squads found.")
		return nil
	}

	w := tabwriter.NewWriter(os.Stdout, 0, 4, 2, ' ', 0)
	fmt.Fprintln(w, "ID\tNAME\tLEADER ID\tMEMBERS")
	for _, s := range squads {
		fmt.Fprintf(w, "%s\t%s\t%s\t%s\n",
			strVal(s, "id"), strVal(s, "name"), strVal(s, "leader_id"),
			memberCountDisplay(s))

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Confirm the server is up: hit the health endpoint or re-run `make dev` and watch logs.
  2. Check the CLI's configured API URL and credentials (flags or config file) against the actual server.
  3. Retry once to rule out a transient blip.
  4. If auth-related, re-authenticate or update the token, then retry.

Example fix

# before
multica squads list   # connection refused

# after
curl -fsS http://127.0.0.1:8080/api/health && multica squads list
Defensive patterns

Strategy: retry

Validate before calling

curl -fsS "$API_URL/api/health" > /dev/null || { echo 'server unreachable'; exit 1; }   # adjust to your health endpoint
multica squads list

Try / catch

Retry once on transient connection errors; never retry 401/403 (re-authenticate instead); on persistent 5xx check server logs. Capture stderr so automation can distinguish environment problems from real API errors.

Prevention

When it happens

Trigger: Server not running (`connection refused`); CLI pointed at the wrong host/port; auth token missing or expired (401/403); server 500 from a database problem; proxy or TLS interception breaking the connection.

Common situations: First command after boot before `make dev` finished starting the server; environment variable for the API URL pointing at a stale tunnel; token rotated on the server but not refreshed in CLI config; DNS failure for a remote server name.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/f49d2eee4def7017. Report an issue: GitHub.