{"record":{"id":"766a215ac97a2f4b","repo":"jackc/pgx","slug":"invalid-tsvector-format-expected-position-number","errorCode":null,"errorMessage":"invalid tsvector format: expected position number","messagePattern":"invalid tsvector format: expected position number","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/tsvector.go","lineNumber":428,"sourceCode":"\t\t\tbreak\n\t\t}\n\n\t\tp.consume() // skip ','\n\t}\n\n\treturn positions, nil\n}\n\n// consumePosition consumes a single position number with optional weight letter.\nfunc (p *tsvectorParser) consumePosition() (TSVectorPosition, error) {\n\tstart := p.pos\n\n\tfor !p.atEnd() && p.peek() >= '0' && p.peek() <= '9' {\n\t\tp.consume()\n\t}\n\n\tif p.pos == start {\n\t\treturn TSVectorPosition{}, fmt.Errorf(\"invalid tsvector format: expected position number\")\n\t}\n\n\tnum, err := strconv.ParseUint(p.str[start:p.pos], 10, 16)\n\tif err != nil {\n\t\treturn TSVectorPosition{}, fmt.Errorf(\"invalid tsvector format: invalid position number %q\", p.str[start:p.pos])\n\t}\n\n\tpos := TSVectorPosition{Position: uint16(num), Weight: TSVectorWeightD}\n\n\t// Check for optional weight letter\n\tif !p.atEnd() {\n\t\tswitch p.peek() {\n\t\tcase 'A', 'a':\n\t\t\tpos.Weight = TSVectorWeightA\n\t\tcase 'B', 'b':\n\t\t\tpos.Weight = TSVectorWeightB\n\t\tcase 'C', 'c':\n\t\t\tpos.Weight = TSVectorWeightC","sourceCodeStart":410,"sourceCodeEnd":446,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/tsvector.go#L410-L446","documentation":"consumePosition expected a decimal position number after ':' or ',' in a lexeme's position list, but no digits were found at the current position (e.g. 'a:,' or 'a:x').","triggerScenarios":"Thrown at pgtype/tsvector.go:428 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Write positions as decimal numbers, e.g. 'a:1,2 b:3'","Remove stray ':' or ',' after lexemes without positions","Regenerate the tsvector with to_tsvector"],"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"}