{"record":{"id":"d5d5fc2cb7b6bcb3","repo":"jackc/pgx","slug":"composite-text-format-must-end-with","errorCode":null,"errorMessage":"composite text format must end with ')'","messagePattern":"composite text format must end with '\\)'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/composite.go","lineNumber":380,"sourceCode":"\trp  int\n\tsrc []byte\n\n\tfieldBytes []byte\n\terr        error\n}\n\n// NewCompositeTextScanner a scanner over a text encoded composite value.\nfunc NewCompositeTextScanner(m *Map, src []byte) *CompositeTextScanner {\n\tif len(src) < 2 {\n\t\treturn &CompositeTextScanner{err: fmt.Errorf(\"Record incomplete %v\", src)}\n\t}\n\n\tif src[0] != '(' {\n\t\treturn &CompositeTextScanner{err: fmt.Errorf(\"composite text format must start with '('\")}\n\t}\n\n\tif src[len(src)-1] != ')' {\n\t\treturn &CompositeTextScanner{err: fmt.Errorf(\"composite text format must end with ')'\")}\n\t}\n\n\treturn &CompositeTextScanner{\n\t\tm:   m,\n\t\trp:  1,\n\t\tsrc: src,\n\t}\n}\n\n// Next advances the scanner to the next field. It returns false after the last field is read or an error occurs. After\n// Next returns false, the Err method can be called to check if any errors occurred.\nfunc (cfs *CompositeTextScanner) Next() bool {\n\tif cfs.err != nil {\n\t\treturn false\n\t}\n\n\tif cfs.rp >= len(cfs.src) {\n\t\treturn false","sourceCodeStart":362,"sourceCodeEnd":398,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/composite.go#L362-L398","documentation":"NewCompositeTextScanner validates the outer shape of a text composite (record) value: it must be parenthesized, and the last byte must be ')'. This error fires when the closing parenthesis is missing, e.g. '(1,2' — the scanner refuses to start on a structurally incomplete record.","triggerScenarios":"Thrown at pgtype/composite.go:380 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the value so it is a well-formed parenthesized record literal","Check for truncation when the composite string was produced or transported"],"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"}