{"record":{"id":"2e0f50b900dbb679","repo":"multica-ai/multica","slug":"list-agent-tasks-w","errorCode":null,"errorMessage":"list agent tasks: %w","messagePattern":"list agent tasks: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/cmd/multica/cmd_agent.go","lineNumber":882,"sourceCode":"\t\treturn cli.PrintJSON(os.Stdout, result)\n\t}\n\n\tfmt.Printf(\"Agent restored: %s (%s)\\n\", strVal(result, \"name\"), strVal(result, \"id\"))\n\treturn nil\n}\n\nfunc runAgentTasks(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 tasks []map[string]any\n\tif err := client.GetJSON(ctx, \"/api/agents/\"+args[0]+\"/tasks\", &tasks); err != nil {\n\t\treturn fmt.Errorf(\"list agent tasks: %w\", err)\n\t}\n\n\toutput, _ := cmd.Flags().GetString(\"output\")\n\tif output == \"json\" {\n\t\treturn cli.PrintJSON(os.Stdout, tasks)\n\t}\n\n\theaders := []string{\"ID\", \"ISSUE_ID\", \"STATUS\", \"CREATED_AT\"}\n\trows := make([][]string, 0, len(tasks))\n\tfor _, t := range tasks {\n\t\trows = append(rows, []string{\n\t\t\tstrVal(t, \"id\"),\n\t\t\tstrVal(t, \"issue_id\"),\n\t\t\tstrVal(t, \"status\"),\n\t\t\tstrVal(t, \"created_at\"),\n\t\t})\n\t}\n\tcli.PrintTable(os.Stdout, headers, rows)","sourceCodeStart":864,"sourceCodeEnd":900,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/cmd/multica/cmd_agent.go#L864-L900","documentation":"Wrapped error returned when `multica agent tasks <id>` fails to GET `/api/agents/{id}/tasks`. The wrapped cause is usually 404 for an unknown agent id, 401/403 for auth problems, or a connection failure when the multica server is unreachable. The endpoint returns the task list assigned to the agent for table or JSON output.","triggerScenarios":"`multica agent tasks <id>` with a mistyped/deleted agent id, an archived agent whose tasks endpoint is restricted, invalid API token, or the server not running.","commonSituations":"Monitoring loops that poll an agent's tasks after the agent was deleted; stale ids in scripts; server restarted with a different database.","solutions":["Verify the agent id via `multica agent list` and retry with the correct one","Confirm the server is up and the API URL/token env vars are valid","If the wrapped error is 403, check workspace membership/permissions for the agent","For scripts, handle 404 as 'agent gone' and stop polling that id"],"exampleFix":"# before\nmultica agent tasks agt_old\n# Error: list agent tasks: 404: agent not found\n\n# after\nmultica agent list\nmultica agent tasks agt_current","handlingStrategy":"try-catch","validationCode":"multica agent get \"$AGENT_ID\" >/dev/null 2>&1 || { echo \"agent $AGENT_ID gone; stop polling\"; exit 0; }\nmultica agent tasks \"$AGENT_ID\"","typeGuard":null,"tryCatchPattern":"tasks, err := fetchAgentTasks(id)\nif err != nil {\n\tif isNotFound(err) { return nil /* agent deleted; stop polling */ }\n\treturn fmt.Errorf(\"list agent tasks: %w\", err)\n}","preventionTips":["In polling loops, stop on 404 instead of retrying","Cache agent ids from `agent list` at loop start and prune dead ones","Use --output json for machine consumption of task lists"],"tags":["cli","api","network","tasks"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}