jackc/pgx · error
invalid tsvector format: unexpected end after backslash
Error message
invalid tsvector format: unexpected end after backslash
What it means
Error "invalid tsvector format: unexpected end after backslash" thrown in jackc/pgx.
Source
Thrown at pgtype/tsvector.go:389
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(), nil
}
case '\\':
next, end := p.consume()
if end {
return "", fmt.Errorf("invalid tsvector format: unexpected end after backslash")
}
buf.WriteByte(next)
default:
buf.WriteByte(ch)
}
}
}
// consumePositions consumes a comma-separated list of position[weight] values.
func (p *tsvectorParser) consumePositions() ([]TSVectorPosition, error) {
var positions []TSVectorPosition
for {
pos, err := p.consumePosition()
if err != nil {
return nil, err
}
positions = append(positions, pos)View on GitHub (pinned to ec1a0befd2)
When it happens
Trigger: Thrown at pgtype/tsvector.go:389 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/81455065689bb807.json.
Report an issue: GitHub.