{"record":{"id":"4d64938046caa6f1","repo":"multica-ai/multica","slug":"get-agent-w","errorCode":null,"errorMessage":"get agent: %w","messagePattern":"get agent: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":577,"sourceCode":"\t\t\tarchived,\n\t\t})\n\t}\n\tcli.PrintTable(os.Stdout, headers, rows)\n\treturn nil\n}\n\nfunc runAgentGet(cmd *cobra.Command, args []string) error {\n\tclient, err := newAPIClient(cmd)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tctx, cancel := cli.APIContext(context.Background())\n\tdefer cancel()\n\n\tvar agent map[string]any\n\tif err := client.GetJSON(ctx, \"/api/agents/\"+args[0], &agent); err != nil {\n\t\treturn fmt.Errorf(\"get agent: %w\", err)\n\t}\n\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\tif output == \"json\" {\n\t\treturn cli.PrintJSON(os.Stdout, agent)\n\t}\n\n\theaders := []string{\"ID\", \"NAME\", \"STATUS\", \"RUNTIME\", \"VISIBILITY\", \"AVATAR_URL\", \"DESCRIPTION\"}\n\trows := [][]string{{\n\t\tstrVal(agent, \"id\"),\n\t\tstrVal(agent, \"name\"),\n\t\tstrVal(agent, \"status\"),\n\t\tstrVal(agent, \"runtime_mode\"),\n\t\tstrVal(agent, \"visibility\"),\n\t\tstrVal(agent, \"avatar_url\"),\n\t\tstrVal(agent, \"description\"),\n\t}}\n\tcli.PrintTable(os.Stdout, headers, rows)","sourceCodeStart":559,"sourceCodeEnd":595,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L559-L595","documentation":"runAgentGet wraps any failure of client.GetJSON against GET /api/agents/{args[0]} for a single agent lookup. The wrapped error distinguishes not-found from auth/transport failures; note args[0] is interpolated into the path unescaped.","triggerScenarios":"Requesting an agent ID that does not exist or is archived/hidden from the caller (404), a token without access to the agent's workspace (403), transport failures to the server URL, or a malformed ID producing a 400.","commonSituations":"Copy-pasting a truncated or stale agent ID; the agent was archived or deleted between list and get; cross-workspace access attempts.","solutions":["Check the wrapped error's status: 404 → wrong/deleted ID, 403 → permission/workspace mismatch.","Re-list agents (`multica agent list`) and copy the exact current ID.","For scripts, look up by name from the list output instead of hardcoding IDs."],"exampleFix":"# before\nmultica agent get agent_999  # -> get agent: 404\n\n# after: find the real ID first\nmultica agent list\nmultica agent get agent_abc123","handlingStrategy":"validation","validationCode":"// Resolve the ID from the trusted list endpoint before a get,\n// so typos and stale IDs surface as a clear not-found locally.\nagents := listAgents(ctx, client)\nvar id string\nfor _, a := range agents {\n    if a[\"name\"] == wantedName {\n        id = a[\"id\"].(string)\n        break\n    }\n}\nif id == \"\" {\n    return fmt.Errorf(\"no agent named %q\", wantedName)\n}","typeGuard":null,"tryCatchPattern":"var agent map[string]any\nif err := client.GetJSON(ctx, \"/api/agents/\"+url.PathEscape(agentID), &agent); err != nil {\n    if strings.Contains(err.Error(), \"404\") {\n        return fmt.Errorf(\"agent %q not found (deleted or archived?): %w\", agentID, err)\n    }\n    return fmt.Errorf(\"get agent: %w\", err)\n}","preventionTips":["Look agents up by name via the list endpoint instead of hardcoding IDs in scripts.","URL-escape the ID when interpolating it into the path.","Treat archived agents as absent in automation; check archived_at in list output."],"tags":["go","cli","http","api","agents"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}