multica-ai/multica · error

list labels: %w

Error message

list labels: %w

What it means

Wraps a failed GET /api/labels (optionally ?workspace_id=...) during `multica label list`. The inner error is the APIClient transport/server error: connectivity, auth, or server-side failure. Labels are workspace-scoped, and the workspace filter is attached automatically when the client has one configured.

Source

Thrown at server/cmd/multica/cmd_label.go:97

	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}
	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	params := url.Values{}
	if client.WorkspaceID != "" {
		params.Set("workspace_id", client.WorkspaceID)
	}
	path := "/api/labels"
	if len(params) > 0 {
		path += "?" + params.Encode()
	}

	var result map[string]any
	if err := client.GetJSON(ctx, path, &result); err != nil {
		return fmt.Errorf("list labels: %w", err)
	}
	labelsRaw, _ := result["labels"].([]any)

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

	fullID, _ := cmd.Flags().GetBool("full-id")
	headers := []string{"ID", "NAME", "COLOR", "CREATED"}
	rows := make([][]string, 0, len(labelsRaw))
	for _, raw := range labelsRaw {
		l, ok := raw.(map[string]any)
		if !ok {
			continue
		}
		created := strVal(l, "created_at")
		if len(created) >= 10 {

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Verify the server is running and reachable at the configured URL (`multica status` or curl the health endpoint)
  2. Re-authenticate: `multica login`
  3. Check the profile/server URL configuration used by the CLI (e.g. --profile flag or env vars)
  4. Retry once for transient network failures
Defensive patterns

Strategy: retry

Validate before calling

# bash: cheap pre-flight before listing
if ! curl -sf "$MULTICA_SERVER/health" >/dev/null; then echo "server unreachable" >&2; exit 2; fi

Try / catch

if err := client.GetJSON(ctx, path, &result); err != nil {
	if isTransient(err) { time.Sleep(time.Second); retry once }
	if isUnauthorized(err) { hint re-login }
	return fmt.Errorf("list labels: %w", err)
}

Prevention

When it happens

Trigger: Server unreachable; expired/invalid token (401); no permission for the workspace; server 5xx; or the client has a WorkspaceID that the server rejects.

Common situations: Running the CLI against a stopped local server; MULTICA_SERVER/URL env pointing at the wrong host; stale credentials after a password rotation; CI environments without a configured profile.

Related errors


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