{"record":{"id":"2977e420157372f2","repo":"sipeed/picoclaw","slug":"invalid-channel-array-field-v","errorCode":null,"errorMessage":"Invalid channel array field: %v","messagePattern":"Invalid channel array field: (.+?)","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"web/backend/api/config.go","lineNumber":66,"sourceCode":"\n// handleUpdateConfig updates the complete system configuration.\n//\n//\tPUT /api/config\nfunc (h *Handler) handleUpdateConfig(w http.ResponseWriter, r *http.Request) {\n\tbody, err := io.ReadAll(io.LimitReader(r.Body, 1<<20))\n\tif err != nil {\n\t\thttp.Error(w, \"Failed to read request body\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tdefer r.Body.Close()\n\n\tvar raw map[string]any\n\tif err = json.Unmarshal(body, &raw); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Invalid JSON: %v\", err), http.StatusBadRequest)\n\t\treturn\n\t}\n\tif err = normalizeChannelArrayFields(raw); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Invalid channel array field: %v\", err), http.StatusBadRequest)\n\t\treturn\n\t}\n\tnormalizedBody, err := json.Marshal(raw)\n\tif err != nil {\n\t\thttp.Error(w, \"Failed to normalize config payload\", http.StatusBadRequest)\n\t\treturn\n\t}\n\tvar cfg config.Config\n\tif err = json.Unmarshal(normalizedBody, &cfg); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Invalid JSON: %v\", err), http.StatusBadRequest)\n\t\treturn\n\t}\n\tcfg.Session.ApplyDmScope()\n\tcfg.Session.DeriveDmScope()\n\tif execAllowRemoteOmitted(body) {\n\t\tcfg.Tools.Exec.AllowRemote = config.DefaultConfig().Tools.Exec.AllowRemote\n\t}\n","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/web/backend/api/config.go#L48-L84","documentation":"Returned as a 400 from handleUpdateConfig when normalizeChannelArrayFields rejects the PUT /api/config payload: a channel field that must be an array of channel identifiers has the wrong shape (e.g. a string or object instead of an array, or invalid elements). The %v carries the underlying normalization error naming the offending field.","triggerScenarios":"Thrown at web/backend/api/config.go:66 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the error detail to identify which channel field failed normalization and fix its JSON shape in the request body","Send channel fields as JSON arrays of valid channel identifier strings","Validate the payload against the config schema before submitting"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}