{"record":{"id":"546a1a5e2c985aa8","repo":"sipeed/picoclaw","slug":"s-contains-unknown-field-s-s","errorCode":null,"errorMessage":"%s contains unknown field(s): %s","messagePattern":"(.+?) contains unknown field\\(s\\): (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/diagnostics.go","lineNumber":24,"sourceCode":"\t\"os\"\n\t\"reflect\"\n\t\"sort\"\n\t\"strings\"\n\t\"unicode/utf8\"\n\n\t\"golang.org/x/term\"\n)\n\nfunc decodeJSONWithDiagnostics(data []byte, target any, label string) error {\n\tvar raw any\n\tif err := json.Unmarshal(data, &raw); err != nil {\n\t\treturn wrapJSONError(data, err, label)\n\t}\n\n\tunknownFields := collectUnknownJSONFields(raw, reflect.TypeOf(target), \"\")\n\tif len(unknownFields) > 0 {\n\t\tsort.Strings(unknownFields)\n\t\treturn fmt.Errorf(\n\t\t\t\"%s contains unknown field(s): %s\",\n\t\t\tlabel,\n\t\t\tstrings.Join(unknownFields, \", \"),\n\t\t)\n\t}\n\n\tif err := json.Unmarshal(data, target); err != nil {\n\t\treturn wrapJSONError(data, err, label)\n\t}\n\treturn nil\n}\n\nfunc DiagnosticSummary(err error) string {\n\tif err == nil {\n\t\treturn \"\"\n\t}\n\tsummary, _ := splitDiagnosticError(err.Error())\n\treturn stripANSISequences(summary)","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/config/diagnostics.go#L6-L42","documentation":"Raised by decodeJSONWithDiagnostics (used by loadConfig and legacy config diagnostics) when the config JSON parses but contains field names that do not exist on the target config struct. Instead of silently ignoring typos, loading fails and lists every unknown field.","triggerScenarios":"Thrown at pkg/config/diagnostics.go:24 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove or rename the listed unknown fields in config.json","Check for typos against the documented config schema","Check whether the field was renamed in a newer config version and run migration instead"],"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"}