{"record":{"id":"bd60f38b9abfbac7","repo":"multica-ai/multica","slug":"workspace-id-is-required-to-resolve-label-id-prefi","errorCode":null,"errorMessage":"workspace_id is required to resolve label id prefixes","messagePattern":"workspace_id is required to resolve label id prefixes","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_id_resolver.go","lineNumber":404,"sourceCode":"\t\t\t}\n\t\t\tcandidates = append(candidates, idCandidate{\n\t\t\t\tID:      strVal(r, \"id\"),\n\t\t\t\tDisplay: display,\n\t\t\t\tDetail:  summarizeResourceRef(r[\"resource_ref\"]),\n\t\t\t})\n\t\t}\n\t\treturn candidates, nil\n\t}\n\treturn resolveIDByPrefix(ctx, client, \"project resource\", input, fetch)\n}\n\nfunc resolveLabelID(ctx context.Context, client *cli.APIClient, input string) (resolvedID, error) {\n\treturn resolveIDByPrefix(ctx, client, \"label\", input, fetchLabelCandidates)\n}\n\nfunc fetchLabelCandidates(ctx context.Context, client *cli.APIClient) ([]idCandidate, error) {\n\tif client.WorkspaceID == \"\" {\n\t\treturn nil, fmt.Errorf(\"workspace_id is required to resolve label id prefixes\")\n\t}\n\tparams := url.Values{\"workspace_id\": {client.WorkspaceID}}\n\tvar result map[string]any\n\tif err := client.GetJSON(ctx, \"/api/labels?\"+params.Encode(), &result); err != nil {\n\t\treturn nil, err\n\t}\n\tlabelsRaw, _ := result[\"labels\"].([]any)\n\tcandidates := make([]idCandidate, 0, len(labelsRaw))\n\tfor _, raw := range labelsRaw {\n\t\tl, ok := raw.(map[string]any)\n\t\tif !ok {\n\t\t\tcontinue\n\t\t}\n\t\tcandidates = append(candidates, idCandidate{\n\t\t\tID:      strVal(l, \"id\"),\n\t\t\tDisplay: strVal(l, \"name\"),\n\t\t\tDetail:  strVal(l, \"color\"),\n\t\t})","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_id_resolver.go#L386-L422","documentation":"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.","triggerScenarios":"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.","commonSituations":"Automation pipelines that assume a default workspace without setting one; configs broken by workspace removal; multi-workspace users whose profile lost its default selection.","solutions":["Configure/select the workspace for the CLI session","Or use the full label UUID (multica label list equivalents with --full-id where available)","Verify workspace access with a simple workspace-scoped list command first"],"exampleFix":"# before\nmultica label rm \"deadbe\"\n# error: workspace_id is required to resolve label id prefixes\n\n# after\nmultica --workspace <workspace-id> label rm \"deadbe\"\n# or: multica label rm <full-uuid>","handlingStrategy":"validation","validationCode":"if client.WorkspaceID == \"\" {\n    return errors.New(\"workspace required for label prefix resolution\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default the workspace in CI environment configuration","Use full label UUIDs when no workspace context is available"],"tags":["cli","workspace","labels","id-resolution"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}