{"record":{"id":"bc79184fbc8eb2b1","repo":"jackc/pgx","slug":"composite-text-format-unterminated-quoted-field","errorCode":null,"errorMessage":"composite text format unterminated quoted field","messagePattern":"composite text format unterminated quoted field","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/composite.go","lineNumber":414,"sourceCode":"\n\tif cfs.rp >= len(cfs.src) {\n\t\treturn false\n\t}\n\n\tswitch cfs.src[cfs.rp] {\n\tcase ',', ')': // null\n\t\tcfs.rp++\n\t\tcfs.fieldBytes = nil\n\t\treturn true\n\tcase '\"': // quoted value\n\t\tcfs.rp++\n\t\tcfs.fieldBytes = make([]byte, 0, 16)\n\tquotedValue:\n\t\tfor {\n\t\t\t// A quote or escape may have consumed the final ')', leaving an\n\t\t\t// unterminated quoted field.\n\t\t\tif cfs.rp >= len(cfs.src) {\n\t\t\t\tcfs.err = fmt.Errorf(\"composite text format unterminated quoted field\")\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tch := cfs.src[cfs.rp]\n\n\t\t\tswitch ch {\n\t\t\tcase '\"':\n\t\t\t\tcfs.rp++\n\t\t\t\tif cfs.rp < len(cfs.src) && cfs.src[cfs.rp] == '\"' {\n\t\t\t\t\tcfs.fieldBytes = append(cfs.fieldBytes, '\"')\n\t\t\t\t\tcfs.rp++\n\t\t\t\t} else {\n\t\t\t\t\tbreak quotedValue\n\t\t\t\t}\n\t\t\tcase '\\\\':\n\t\t\t\tcfs.rp++\n\t\t\t\tif cfs.rp >= len(cfs.src) {\n\t\t\t\t\tcfs.err = fmt.Errorf(\"composite text format unterminated quoted field\")\n\t\t\t\t\treturn false","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/composite.go#L396-L432","documentation":"Returned by CompositeTextScanner.Next while parsing a double-quoted field: the input ended before the closing quote was found, leaving an unterminated quoted field. A quote or escape consumed the final ')' without closing the value.","triggerScenarios":"Thrown at pgtype/composite.go:414 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the composite literal so every quoted field is terminated","Check for truncation of the value in transit"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}