multica-ai/multica · error

get agent: %w

Error message

get agent: %w

What it means

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.

Source

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

			archived,
		})
	}
	cli.PrintTable(os.Stdout, headers, rows)
	return nil
}

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

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

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

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

	headers := []string{"ID", "NAME", "STATUS", "RUNTIME", "VISIBILITY", "AVATAR_URL", "DESCRIPTION"}
	rows := [][]string{{
		strVal(agent, "id"),
		strVal(agent, "name"),
		strVal(agent, "status"),
		strVal(agent, "runtime_mode"),
		strVal(agent, "visibility"),
		strVal(agent, "avatar_url"),
		strVal(agent, "description"),
	}}
	cli.PrintTable(os.Stdout, headers, rows)

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Check the wrapped error's status: 404 → wrong/deleted ID, 403 → permission/workspace mismatch.
  2. Re-list agents (`multica agent list`) and copy the exact current ID.
  3. For scripts, look up by name from the list output instead of hardcoding IDs.

Example fix

# before
multica agent get agent_999  # -> get agent: 404

# after: find the real ID first
multica agent list
multica agent get agent_abc123
Defensive patterns

Strategy: validation

Validate before calling

// Resolve the ID from the trusted list endpoint before a get,
// so typos and stale IDs surface as a clear not-found locally.
agents := listAgents(ctx, client)
var id string
for _, a := range agents {
    if a["name"] == wantedName {
        id = a["id"].(string)
        break
    }
}
if id == "" {
    return fmt.Errorf("no agent named %q", wantedName)
}

Try / catch

var agent map[string]any
if err := client.GetJSON(ctx, "/api/agents/"+url.PathEscape(agentID), &agent); err != nil {
    if strings.Contains(err.Error(), "404") {
        return fmt.Errorf("agent %q not found (deleted or archived?): %w", agentID, err)
    }
    return fmt.Errorf("get agent: %w", err)
}

Prevention

When it happens

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

Common situations: Copy-pasting a truncated or stale agent ID; the agent was archived or deleted between list and get; cross-workspace access attempts.

Related errors


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