multica-ai/multica · error

list agent tasks: %w

Error message

list agent tasks: %w

What it means

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.

Source

Thrown at server/cmd/multica/cmd_agent.go:882

		return cli.PrintJSON(os.Stdout, result)
	}

	fmt.Printf("Agent restored: %s (%s)\n", strVal(result, "name"), strVal(result, "id"))
	return nil
}

func runAgentTasks(cmd *cobra.Command, args []string) error {
	client, err := newAPIClient(cmd)
	if err != nil {
		return err
	}

	ctx, cancel := cli.APIContext(context.Background())
	defer cancel()

	var tasks []map[string]any
	if err := client.GetJSON(ctx, "/api/agents/"+args[0]+"/tasks", &tasks); err != nil {
		return fmt.Errorf("list agent tasks: %w", err)
	}

	output, _ := cmd.Flags().GetString("output")
	if output == "json" {
		return cli.PrintJSON(os.Stdout, tasks)
	}

	headers := []string{"ID", "ISSUE_ID", "STATUS", "CREATED_AT"}
	rows := make([][]string, 0, len(tasks))
	for _, t := range tasks {
		rows = append(rows, []string{
			strVal(t, "id"),
			strVal(t, "issue_id"),
			strVal(t, "status"),
			strVal(t, "created_at"),
		})
	}
	cli.PrintTable(os.Stdout, headers, rows)

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Verify the agent id via `multica agent list` and retry with the correct one
  2. Confirm the server is up and the API URL/token env vars are valid
  3. If the wrapped error is 403, check workspace membership/permissions for the agent
  4. For scripts, handle 404 as 'agent gone' and stop polling that id

Example fix

# before
multica agent tasks agt_old
# Error: list agent tasks: 404: agent not found

# after
multica agent list
multica agent tasks agt_current
Defensive patterns

Strategy: try-catch

Validate before calling

multica agent get "$AGENT_ID" >/dev/null 2>&1 || { echo "agent $AGENT_ID gone; stop polling"; exit 0; }
multica agent tasks "$AGENT_ID"

Try / catch

tasks, err := fetchAgentTasks(id)
if err != nil {
	if isNotFound(err) { return nil /* agent deleted; stop polling */ }
	return fmt.Errorf("list agent tasks: %w", err)
}

Prevention

When it happens

Trigger: `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.

Common situations: Monitoring loops that poll an agent's tasks after the agent was deleted; stale ids in scripts; server restarted with a different database.

Related errors


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