multica-ai/multica · error

get squad: %w

Error message

get squad: %w

What it means

Returned by `multica squads get <id>` when GET `/api/squads/{id}` fails. The squad ID is interpolated raw into the URL, so a mistyped, stale, or malformed ID producing a 404 is the dominant cause, alongside the usual transport/auth/timeout failures.

Source

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

var squadGetCmd = &cobra.Command{
	Use:   "get <squad-id>",
	Short: "Get squad details",
	Args:  exactArgs(1),
	RunE:  runSquadGet,
}

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

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

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

	fmt.Printf("ID:           %s\n", strVal(squad, "id"))
	fmt.Printf("Name:         %s\n", strVal(squad, "name"))
	fmt.Printf("Description:  %s\n", strVal(squad, "description"))
	fmt.Printf("Leader ID:    %s\n", strVal(squad, "leader_id"))
	fmt.Printf("Created:      %s\n", strVal(squad, "created_at"))
	if inst := strVal(squad, "instructions"); inst != "" {
		fmt.Printf("Instructions: %s\n", inst)
	}
	return nil
}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Resolve the real ID first: `multica squads list --output json` and select by name.
  2. Quote the ID and strip whitespace in scripts.
  3. Confirm the target environment matches where the squad was created.

Example fix

# before
multica squads get alpha-team   # name used as ID

# after
SID=$(multica squads list --output json | jq -r '.[] | select(.name=="alpha-team") | .id')
multica squads get "$SID"
Defensive patterns

Strategy: validation

Validate before calling

SID="$(multica squads list --output json | jq -r --arg n "$SQUAD_NAME" '.[] | select(.name==$n) | .id')"
[ -n "$SID" ] || { echo "no squad named $SQUAD_NAME"; exit 1; }
multica squads get "$SID"

Try / catch

On failure, branch on the wrapped cause: 404 → re-resolve the ID via squads list; auth/transport → fix environment; other → capture message and check server logs. Do not blind-retry with the same ID after a 404.

Prevention

When it happens

Trigger: Squad ID that never existed or was deleted; using the squad NAME instead of its ID; ID with stray whitespace/newline from copy-paste; wrong environment (dev vs prod); auth failure.

Common situations: Grabbing IDs from old terminal output after the server database was reset; name-vs-ID confusion because the list table shows names prominently; scripting against `squads list` JSON with an incorrect jq field.

Related errors


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