{"record":{"id":"9bdd65f2b9a6e1a4","repo":"multica-ai/multica","slug":"workspace-id-is-required-to-resolve-agents-use","errorCode":null,"errorMessage":"workspace ID is required to resolve agents; use --workspace-id or set MULTICA_WORKSPACE_ID","messagePattern":"workspace ID is required to resolve agents; use --workspace-id or set MULTICA_WORKSPACE_ID","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_autopilot.go","lineNumber":782,"sourceCode":"\t}\n\treturn inputs, nil\n}\n\n// ---------------------------------------------------------------------------\n// Helpers\n// ---------------------------------------------------------------------------\n\n// uuidRegexp matches a canonical UUID (8-4-4-4-12 hex).\nvar uuidRegexp = regexp.MustCompile(`^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$`)\n\n// resolveAgent accepts either a UUID or an agent name (case-insensitive substring)\n// and returns the agent's UUID. Errors on no match or ambiguous match.\nfunc resolveAgent(ctx context.Context, client *cli.APIClient, nameOrID string) (string, error) {\n\tif uuidRegexp.MatchString(nameOrID) {\n\t\treturn nameOrID, nil\n\t}\n\tif client.WorkspaceID == \"\" {\n\t\treturn \"\", fmt.Errorf(\"workspace ID is required to resolve agents; use --workspace-id or set MULTICA_WORKSPACE_ID\")\n\t}\n\n\tvar agents []map[string]any\n\tagentPath := \"/api/agents?\" + url.Values{\"workspace_id\": {client.WorkspaceID}}.Encode()\n\tif err := client.GetJSON(ctx, agentPath, &agents); err != nil {\n\t\treturn \"\", fmt.Errorf(\"fetch agents: %w\", err)\n\t}\n\n\tnameLower := strings.ToLower(nameOrID)\n\ttype match struct{ ID, Name string }\n\tvar matches []match\n\tfor _, a := range agents {\n\t\taName := strVal(a, \"name\")\n\t\tif strings.Contains(strings.ToLower(aName), nameLower) {\n\t\t\tmatches = append(matches, match{ID: strVal(a, \"id\"), Name: aName})\n\t\t}\n\t}\n","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_autopilot.go#L764-L800","documentation":"resolveAgent accepts a bare agent name only when it can scope the lookup to a workspace (GET /api/agents?workspace_id=...). If the argument is not a canonical UUID (uuidRegexp) and client.WorkspaceID is empty, name resolution is impossible and the CLI refuses rather than searching across workspaces.","triggerScenarios":"Running an autopilot command with an agent name (not UUID) while --workspace-id is omitted and MULTICA_WORKSPACE_ID is unset, e.g. `multica autopilot trigger create --agent triage-bot` in a fresh shell.","commonSituations":"New machine or CI environment without the env var persisted; switching workspaces and the cached config cleared; scripting that assumes the workspace is implicit.","solutions":["Pass --workspace-id <uuid> on the command.","Or export MULTICA_WORKSPACE_ID=<uuid> (persist in shell profile / CI secrets).","Or use the agent's full UUID as the --agent value, which bypasses workspace-scoped lookup entirely."],"exampleFix":"# before\nmultica autopilot trigger create --name t1 --agent triage-bot\n# after\nMULTICA_WORKSPACE_ID=ws-uuid multica autopilot trigger create --name t1 --agent triage-bot","handlingStrategy":"validation","validationCode":"# ensure a workspace is always in scope\n: \"${MULTICA_WORKSPACE_ID:?set MULTICA_WORKSPACE_ID or pass --workspace-id}\"\nmultica autopilot trigger create --name t1 --agent triage-bot","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Export MULTICA_WORKSPACE_ID in shell profile and CI environment.","Cache agent UUIDs in scripts; UUIDs skip workspace-scoped name resolution entirely."],"tags":["cli","configuration","agents","workspace","go"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}