jackc/pgx · error
invalid tsvector format: lexeme must start with a single quo
Error message
invalid tsvector format: lexeme must start with a single quote
What it means
Error "invalid tsvector format: lexeme must start with a single quote" thrown in jackc/pgx.
Source
Thrown at pgtype/tsvector.go:366
if p.pos >= len(p.str) {
return 0, true
}
b := p.str[p.pos]
p.pos++
return b, false
}
func (p *tsvectorParser) consumeSpaces() {
for !p.atEnd() && p.peek() == ' ' {
p.consume()
}
}
// consumeLexeme consumes a single-quoted lexeme, handling single quotes and backslash escapes.
func (p *tsvectorParser) consumeLexeme() (string, error) {
ch, end := p.consume()
if end || ch != '\'' {
return "", fmt.Errorf("invalid tsvector format: lexeme must start with a single quote")
}
var buf strings.Builder
for {
ch, end := p.consume()
if end {
return "", fmt.Errorf("invalid tsvector format: unterminated quoted lexeme")
}
switch ch {
case '\'':
// Escaped quote ('') — write a literal single quote
if !p.atEnd() && p.peek() == '\'' {
p.consume()
buf.WriteByte('\'')
} else {
// Closing quote — lexeme is complete
return buf.String(), nilView on GitHub (pinned to ec1a0befd2)
When it happens
Trigger: Thrown at pgtype/tsvector.go:366 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of jackc/pgx@ec1a0befd2 (2026-08-04).
Data as JSON: /data/errors/d361e3dd0c5bc5b5.json.
Report an issue: GitHub.