sipeed/picoclaw · error
Failed to normalize config payload
Error message
Failed to normalize config payload
What it means
Returned as a 400 from handleUpdateConfig when the already-unmarshaled raw config map cannot be re-marshaled to bytes after channel-array normalization (json.Marshal of map[string]any failed). This is an internal serialization failure, not client input error.
Solutions
- Retry the request; the payload was already valid JSON if unmarshal succeeded
- Report the issue with the payload if reproducible, since a valid JSON map should always re-marshal
- Check for exotic values injected by middleware that break round-tripping
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at web/backend/api/config.go:71 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/985ac49ba76b84dc.
Report an issue: GitHub.
Appendix: source
Thrown at web/backend/api/config.go:71
body, err := io.ReadAll(io.LimitReader(r.Body, 1<<20))
if err != nil {
http.Error(w, "Failed to read request body", http.StatusBadRequest)
return
}
defer r.Body.Close()
var raw map[string]any
if err = json.Unmarshal(body, &raw); err != nil {
http.Error(w, fmt.Sprintf("Invalid JSON: %v", err), http.StatusBadRequest)
return
}
if err = normalizeChannelArrayFields(raw); err != nil {
http.Error(w, fmt.Sprintf("Invalid channel array field: %v", err), http.StatusBadRequest)
return
}
normalizedBody, err := json.Marshal(raw)
if err != nil {
http.Error(w, "Failed to normalize config payload", http.StatusBadRequest)
return
}
var cfg config.Config
if err = json.Unmarshal(normalizedBody, &cfg); err != nil {
http.Error(w, fmt.Sprintf("Invalid JSON: %v", err), http.StatusBadRequest)
return
}
cfg.Session.ApplyDmScope()
cfg.Session.DeriveDmScope()
if execAllowRemoteOmitted(body) {
cfg.Tools.Exec.AllowRemote = config.DefaultConfig().Tools.Exec.AllowRemote
}
// Load existing config and copy security credentials before validation,
// so that security-managed fields (e.g. pico token) are available.
err = cfg.SecurityCopyFrom(h.configPath)
if err != nil {
http.Error(w, fmt.Sprintf("Failed to apply security config: %v", err), http.StatusInternalServerError)View on GitHub (pinned to 49183d7e8d)