{"record":{"id":"684e2cacc0e61b3d","repo":"sipeed/picoclaw","slug":"failed-to-serialize-current-config","errorCode":null,"errorMessage":"Failed to serialize current config","messagePattern":"Failed to serialize current config","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"web/backend/api/config.go","lineNumber":157,"sourceCode":"\t}\n\tdefer r.Body.Close()\n\n\t// Validate the patch is valid JSON\n\tvar patch map[string]any\n\tif err = json.Unmarshal(patchBody, &patch); err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Invalid JSON: %v\", err), http.StatusBadRequest)\n\t\treturn\n\t}\n\n\t// Load existing config and marshal to a map for merging\n\tcfg, err := config.LoadConfig(h.configPath)\n\tif err != nil {\n\t\thttp.Error(w, fmt.Sprintf(\"Failed to load config: %v\", err), http.StatusInternalServerError)\n\t\treturn\n\t}\n\texisting, err := json.Marshal(cfg)\n\tif err != nil {\n\t\thttp.Error(w, \"Failed to serialize current config\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\tvar base map[string]any\n\tif err = json.Unmarshal(existing, &base); err != nil {\n\t\thttp.Error(w, \"Failed to parse current config\", http.StatusInternalServerError)\n\t\treturn\n\t}\n\n\t// Recursively merge patch into base\n\tmergeMap(base, patch)\n\n\t// When the patch updates dm_scope, the old derived dimensions from the\n\t// base must be cleared so that ApplyDmScope() can re-derive them from\n\t// the new dm_scope value. Otherwise the stale dimensions survive the\n\t// merge and ApplyDmScope() exits early due to its precedence guard.\n\tif sess, ok := base[\"session\"].(map[string]any); ok {\n\t\tif patchSess, patchHasSession := patch[\"session\"].(map[string]any); patchHasSession {","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/web/backend/api/config.go#L139-L175","documentation":"Error \"Failed to serialize current config\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at web/backend/api/config.go:157 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}