multica-ai/multica · error
get source agent: %w
Error message
get source agent: %w
What it means
Thrown by `multica agent copy <id>` when the initial GET /api/agents/{id} to fetch the source agent fails. The wrapped error carries the HTTP layer cause: 404 unknown agent ID, 401/403 auth failure, connection refused to the API server, or a malformed server response. Nothing else in the copy flow runs until this succeeds.
Source
Thrown at server/cmd/multica/cmd_agent_copy.go:107
if cmd.Flags().Changed("max-concurrent-tasks") {
v, _ := cmd.Flags().GetInt32("max-concurrent-tasks")
if err := validateAgentMaxConcurrentTasksFlag(v); err != nil {
return err
}
maxConcurrentTasksOverride = &v
}
client, err := newAPIClient(cmd)
if err != nil {
return err
}
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
var src map[string]any
if err := client.GetJSON(ctx, "/api/agents/"+args[0], &src); err != nil {
return fmt.Errorf("get source agent: %w", err)
}
srcRuntimeID := strVal(src, "runtime_id")
// Resolve the target runtime: default to the source's runtime, override
// with --runtime-id. A different value is a cross-runtime fork.
targetRuntimeID := srcRuntimeID
if cmd.Flags().Changed("runtime-id") {
v, _ := cmd.Flags().GetString("runtime-id")
if v == "" {
return fmt.Errorf("--runtime-id must not be empty")
}
targetRuntimeID = v
}
if targetRuntimeID == "" {
return fmt.Errorf("source agent has no runtime; pass --runtime-id to choose a target runtime")
}
sameRuntime := targetRuntimeID == srcRuntimeIDView on GitHub (pinned to 2c0912b6ec)
Solutions
- Confirm the agent exists in this environment: multica agent get <id> (or agent list) and re-copy the ID
- Check API connectivity and auth: verify the CLI's server URL and token configuration, retry after multica login or token refresh
- If the server is down, start it / fix the base URL, then retry the copy
Example fix
# before multica agent copy abc123 # stale id from another workspace # after multica agent list --output json | jq '.[].id' multica agent copy <fresh-id>
Defensive patterns
Strategy: try-catch
Validate before calling
# confirm the agent exists before copying
multica agent get "$AGENT_ID" >/dev/null 2>&1 || { echo "agent $AGENT_ID not found" >&2; exit 1; }
multica agent copy "$AGENT_ID" Try / catch
In Go API clients: var src map[string]any; if err := client.GetJSON(ctx, "/api/agents/"+id, &src); err != nil { return fmt.Errorf("get source agent: %w", err) } — inspect errors.Is/As on the wrapped HTTP error to distinguish 404 (bad ID) from 401 (auth) from network errors. Prevention
- Always fetch IDs from a live listing in the same environment, never from notes or other workspaces
- Re-verify IDs in long-running scripts right before use
- Keep CLI auth fresh; run a cheap authenticated call first to fail fast
When it happens
Trigger: `multica agent copy <bad-or-deleted-id>`; CLI pointed at the wrong API base URL; expired or missing API token; API server not running or unreachable from the network.
Common situations: Copying an agent ID copied from a different workspace/environment; the agent was deleted between listing and copying; dev CLI pointed at prod URL or vice versa; token expired after long-lived shell session.
Related errors
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/805f6c1d5a054a04.
Report an issue: GitHub.