multica-ai/multica · error
update agent avatar: %w
Error message
update agent avatar: %w
What it means
Final wrapped error in the avatar flow: after a successful upload the CLI PUTs {"avatar_url": url} to `/api/agents/{id}` to attach the URL to the agent. Failure at this point means the agent disappeared mid-flow, auth/session expired between calls, or the server rejected the avatar_url value — note the upload itself already succeeded and remains stored.
Source
Thrown at server/cmd/multica/cmd_agent.go:962
ctx, cancel := context.WithTimeout(context.Background(), cli.AtLeastAPITimeout(60*time.Second))
defer cancel()
// Agent existence pre-check.
var agent map[string]any
if err := client.GetJSON(ctx, "/api/agents/"+args[0], &agent); err != nil {
return fmt.Errorf("get agent: %w", err)
}
id, url, err := client.UploadFileWithURL(ctx, fileData, filePath)
if err != nil {
return fmt.Errorf("upload avatar: %w", err)
}
body := map[string]any{"avatar_url": url}
var result map[string]any
if err := client.PutJSON(ctx, "/api/agents/"+args[0], body, &result); err != nil {
return fmt.Errorf("update agent avatar: %w", err)
}
output, _ := cmd.Flags().GetString("output")
if output == "json" {
return cli.PrintJSON(os.Stdout, map[string]any{
"id": id,
"agent_id": args[0],
"avatar_url": url,
})
}
headers := []string{"ID", "AGENT_ID", "AVATAR_URL"}
rows := [][]string{{
id,
args[0],
url,
}}
cli.PrintTable(os.Stdout, headers, rows)View on GitHub (pinned to 2c0912b6ec)
Solutions
- Verify the agent still exists (`multica agent get <id>`) and re-attach: the file is uploaded, so retry the full command (re-upload is cheap and idempotent in effect)
- If sessions are expiring, re-authenticate and retry the whole `agent avatar` command
- Check server logs if the PUT returns 400 for the avatar_url — a server/storage misconfiguration
- Retry once for transient 5xx before investigating further
Example fix
# before (agent deleted mid-upload) multica agent avatar agt_1 --file me.png # Error: update agent avatar: 404: agent not found # after multica agent list # recreate/re-find agent multica agent avatar agt_1 --file me.png # re-run; upload repeats cleanly
Defensive patterns
Strategy: retry
Validate before calling
multica agent get "$AGENT_ID" >/dev/null 2>&1 || { echo 'agent missing; abort avatar flow'; exit 1; } Try / catch
if err := client.PutJSON(ctx, "/api/agents/"+args[0], body, &result); err != nil {
return fmt.Errorf("update agent avatar: %w", err) // upload succeeded; rerun full command is safe
} Prevention
- Avoid concurrent delete/archive operations while running avatar commands
- Re-authenticate before long-running CLI sessions to prevent mid-flow expiry
- On failure, just re-run the whole avatar command — the flow is effectively idempotent
When it happens
Trigger: Agent deleted or archived between the GET pre-check and the PUT; token expires during a slow upload; server rejects the returned upload URL format; transient 5xx during the update.
Common situations: Concurrent admin operations deleting the agent, long uploads crossing session expiry windows, server restarts mid-command.
Related errors
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/0e5cd9085ae9761f.
Report an issue: GitHub.