{"record":{"id":"f49d2eee4def7017","repo":"multica-ai/multica","slug":"list-squads-w","errorCode":null,"errorMessage":"list squads: %w","messagePattern":"list squads: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_squad.go","lineNumber":39,"sourceCode":"\nvar squadListCmd = &cobra.Command{\n\tUse:   \"list\",\n\tShort: \"List squads in the workspace\",\n\tArgs:  cobra.NoArgs,\n\tRunE:  runSquadList,\n}\n\nfunc runSquadList(cmd *cobra.Command, _ []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar squads []map[string]any\n\tif err := client.GetJSON(ctx, \"/api/squads\", &squads); err != nil {\n\t\treturn fmt.Errorf(\"list squads: %w\", err)\n\t}\n\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\tif output == \"json\" {\n\t\treturn cli.PrintJSON(os.Stdout, squads)\n\t}\n\n\tif len(squads) == 0 {\n\t\tfmt.Fprintln(os.Stderr, \"No squads found.\")\n\t\treturn nil\n\t}\n\n\tw := tabwriter.NewWriter(os.Stdout, 0, 4, 2, ' ', 0)\n\tfmt.Fprintln(w, \"ID\\tNAME\\tLEADER ID\\tMEMBERS\")\n\tfor _, s := range squads {\n\t\tfmt.Fprintf(w, \"%s\\t%s\\t%s\\t%s\\n\",\n\t\t\tstrVal(s, \"id\"), strVal(s, \"name\"), strVal(s, \"leader_id\"),\n\t\t\tmemberCountDisplay(s))","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_squad.go#L21-L57","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Confirm the server is up: hit the health endpoint or re-run `make dev` and watch logs.","Check the CLI's configured API URL and credentials (flags or config file) against the actual server.","Retry once to rule out a transient blip.","If auth-related, re-authenticate or update the token, then retry."],"exampleFix":"# before\nmultica squads list   # connection refused\n\n# after\ncurl -fsS http://127.0.0.1:8080/api/health && multica squads list","handlingStrategy":"retry","validationCode":"curl -fsS \"$API_URL/api/health\" > /dev/null || { echo 'server unreachable'; exit 1; }   # adjust to your health endpoint\nmultica squads list","typeGuard":null,"tryCatchPattern":"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.","preventionTips":["Health-check the server before running squad commands in scripts or CI.","Keep CLI config (API URL, token) in sync with the environment you target.","Wait for `make dev` to report the server ready before issuing commands."],"tags":["cli","http","squad","connectivity"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}