multica-ai/multica · error

workspace_id is required to resolve label id prefixes

Error message

workspace_id is required to resolve label id prefixes

What it means

Returned by fetchLabelCandidates when the CLI client has no WorkspaceID set. Label listing is workspace-scoped (/api/labels requires workspace_id), so there is no candidate list to prefix-match against. A full label UUID never triggers this because it short-circuits in resolveIDByPrefix.

Source

Thrown at server/cmd/multica/cmd_id_resolver.go:404

			}
			candidates = append(candidates, idCandidate{
				ID:      strVal(r, "id"),
				Display: display,
				Detail:  summarizeResourceRef(r["resource_ref"]),
			})
		}
		return candidates, nil
	}
	return resolveIDByPrefix(ctx, client, "project resource", input, fetch)
}

func resolveLabelID(ctx context.Context, client *cli.APIClient, input string) (resolvedID, error) {
	return resolveIDByPrefix(ctx, client, "label", input, fetchLabelCandidates)
}

func fetchLabelCandidates(ctx context.Context, client *cli.APIClient) ([]idCandidate, error) {
	if client.WorkspaceID == "" {
		return nil, fmt.Errorf("workspace_id is required to resolve label id prefixes")
	}
	params := url.Values{"workspace_id": {client.WorkspaceID}}
	var result map[string]any
	if err := client.GetJSON(ctx, "/api/labels?"+params.Encode(), &result); err != nil {
		return nil, err
	}
	labelsRaw, _ := result["labels"].([]any)
	candidates := make([]idCandidate, 0, len(labelsRaw))
	for _, raw := range labelsRaw {
		l, ok := raw.(map[string]any)
		if !ok {
			continue
		}
		candidates = append(candidates, idCandidate{
			ID:      strVal(l, "id"),
			Display: strVal(l, "name"),
			Detail:  strVal(l, "color"),
		})

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Configure/select the workspace for the CLI session
  2. Or use the full label UUID (multica label list equivalents with --full-id where available)
  3. Verify workspace access with a simple workspace-scoped list command first

Example fix

# before
multica label rm "deadbe"
# error: workspace_id is required to resolve label id prefixes

# after
multica --workspace <workspace-id> label rm "deadbe"
# or: multica label rm <full-uuid>
Defensive patterns

Strategy: validation

Validate before calling

if client.WorkspaceID == "" {
    return errors.New("workspace required for label prefix resolution")
}

Prevention

When it happens

Trigger: Using a short label UUID prefix in a CLI invocation where WorkspaceID is empty — no workspace configured, workspace flag omitted in scripts, or client built without workspace context.

Common situations: Automation pipelines that assume a default workspace without setting one; configs broken by workspace removal; multi-workspace users whose profile lost its default selection.

Related errors


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