multica-ai/multica · error

list runs: %w

Error message

list runs: %w

What it means

Wrapped error from GET /api/autopilots/{id}/runs (with optional limit/offset query params) in `multica autopilot runs`. The autopilot already resolved, so this failure is purely about fetching the run history: HTTP error status, network failure, or response body not matching the {runs, total} shape.

Source

Thrown at server/cmd/multica/cmd_autopilot.go:514

	params := url.Values{}
	if v, _ := cmd.Flags().GetInt("limit"); v > 0 {
		params.Set("limit", fmt.Sprintf("%d", v))
	}
	if v, _ := cmd.Flags().GetInt("offset"); v > 0 {
		params.Set("offset", fmt.Sprintf("%d", v))
	}
	path := "/api/autopilots/" + autopilotRef.ID + "/runs"
	if len(params) > 0 {
		path += "?" + params.Encode()
	}

	var resp struct {
		Runs  []map[string]any `json:"runs"`
		Total int              `json:"total"`
	}
	if err := client.GetJSON(ctx, path, &resp); err != nil {
		return fmt.Errorf("list runs: %w", err)
	}

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

	headers := []string{"ID", "SOURCE", "STATUS", "ISSUE", "TRIGGERED_AT", "COMPLETED_AT"}
	rows := make([][]string, 0, len(resp.Runs))
	for _, r := range resp.Runs {
		rows = append(rows, []string{
			strVal(r, "id"),
			strVal(r, "source"),
			strVal(r, "status"),
			strVal(r, "issue_id"),
			strVal(r, "triggered_at"),
			strVal(r, "completed_at"),
		})

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Retry after checking the wrapped status — 5xx/network errors are usually transient
  2. Reduce the window with `--limit` (e.g. --limit 20) to shrink the query
  3. Confirm the autopilot still exists: `multica autopilots list`
  4. Re-authenticate if the wrapped error shows 401

Example fix

// before
multica autopilot runs my-pilot
// list runs: request failed: 504 Gateway Timeout

// after
multica autopilot runs my-pilot --limit 20 --offset 0
Defensive patterns

Strategy: retry

Try / catch

Catch the CLI exit status; distinguish 5xx/network (retry with backoff, bounded) from 401/403/404 (fail with the message). Paginate with --limit/--offset to keep responses small.

Prevention

When it happens

Trigger: Server returns 401/403 for the runs endpoint, 404 if the autopilot was deleted between resolution and the runs call, 5xx during query execution, connection reset, or the context from cli.APIContext is cancelled.

Common situations: Token revoked between two back-to-back requests; heavy database load making the runs query time out; querying runs of an autopilot that another operator just archived.

Related errors


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