multica-ai/multica · error
update agent env
Error message
update agent env: %w
What it means
CLI error in runAgentEnvSet: the PUT to /api/agents/{id}/env was rejected (auth, connectivity, or server-side validation of the env payload) and is wrapped with 'update agent env: %w'. Inspect the wrapped error for the API's rejection reason.
Solutions
- Check server connectivity and permissions, then retry updating the agent env.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at server/cmd/multica/cmd_agent.go:1178 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15).
Data as JSON: /api/errors/824655bb865f71d4.
Report an issue: GitHub.
Appendix: source
Thrown at server/cmd/multica/cmd_agent.go:1178
return err
}
ce, ok, err := resolveCustomEnv(cmd)
if err != nil {
return err
}
if !ok {
return fmt.Errorf("specify the new env via --custom-env, --custom-env-stdin, or --custom-env-file (pass '{}' to clear)")
}
body := map[string]any{"custom_env": ce}
ctx, cancel := cli.APIContext(context.Background())
defer cancel()
var result map[string]any
if err := client.PutJSON(ctx, "/api/agents/"+args[0]+"/env", body, &result); err != nil {
return fmt.Errorf("update agent env: %w", err)
}
output, _ := cmd.Flags().GetString("output")
if output == "json" {
return cli.PrintJSON(os.Stdout, result)
}
env, _ := result["custom_env"].(map[string]any)
fmt.Printf("Env updated for agent %s (%d keys)\n", args[0], len(env))
return nil
}
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
// parseCustomEnv parses the --custom-env flag value (a JSON object literal)
// into a string map suitable for the request body. The clear-all signal isView on GitHub (pinned to 2c0912b6ec)