{"record":{"id":"9e36f0256c00b01d","repo":"vxcontrol/pentagi","slug":"invalid-strings-value-expected-a-json-array-of-st","errorCode":null,"errorMessage":"invalid strings value: expected a JSON array of strings, got: null","messagePattern":"invalid strings value: expected a JSON array of strings, got: null","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/pkg/tools/args.go","lineNumber":512,"sourceCode":"\t}\n\treturn s\n}\n\n// Strings is a lenient []string for LLM-generated tool-call arguments (e.g.\n// the \"questions\" field of vector-store search tools). Models occasionally\n// double-encode the array as a JSON string containing the array literal\n// (e.g. \"[\\\"a\\\", \\\"b\\\"]\" instead of a real [\"a\",\"b\"]), which fails a plain\n// []string unmarshal with \"cannot unmarshal string into ... []string\" and\n// forces an unnecessary tool-call-fixer round-trip. UnmarshalJSON recovers\n// from that case instead of failing outright.\ntype Strings []string\n\nfunc (s *Strings) UnmarshalJSON(data []byte) error {\n\t// A bare JSON \"null\" unmarshals into a nil slice with no error by default,\n\t// which would silently mask a required field being omitted - treat it as\n\t// invalid instead, consistent with Bool/Int64 above.\n\tif trimmed := strings.TrimSpace(string(data)); trimmed == \"null\" {\n\t\treturn fmt.Errorf(\"invalid strings value: expected a JSON array of strings, got: null\")\n\t}\n\n\t// Primary path: a real JSON array of strings - the common, schema-conforming case.\n\tvar arr []string\n\tif err := json.Unmarshal(data, &arr); err == nil {\n\t\t*s = arr\n\t\treturn nil\n\t}\n\n\t// Recovery path: the array was sent as a JSON string. Try to decode its\n\t// content as a JSON array of strings first (the double-encoding case seen\n\t// in production), then fall back to treating the whole string as a single\n\t// element so one plain question doesn't fail either.\n\tvar encoded string\n\tif err := json.Unmarshal(data, &encoded); err == nil {\n\t\tvar nested []string\n\t\tif err := json.Unmarshal([]byte(encoded), &nested); err == nil {\n\t\t\t*s = nested","sourceCodeStart":494,"sourceCodeEnd":530,"githubUrl":"https://github.com/vxcontrol/pentagi/blob/ea665308baaff015b226f308438a68d929d0f29b/backend/pkg/tools/args.go#L494-L530","documentation":"Error \"invalid strings value: expected a JSON array of strings, got: null\" thrown in vxcontrol/pentagi.","triggerScenarios":"Thrown at backend/pkg/tools/args.go:512 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":"ea665308baaff015b226f308438a68d929d0f29b","analyzedAt":"2026-09-01T14:16:31.421Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}