jackc/pgx · error

found end instead of value

Error message

found end instead of value

What it means

consumeDoubleQuotedOrNull guard in the hstore parser: at the position where a key or value (quoted string or NULL) was expected, the input is already exhausted. The hstore literal ends abruptly after a separator; the truncated trailing portion is the faulty input.

Solutions

  1. Complete the final key=>value pair in the hstore literal
  2. Remove any dangling ", " or "=>" separator at the end
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pgtype/hstore.go:403 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: /api/errors/5dc0e38ceb6574e9. Report an issue: GitHub.

Appendix: source

Thrown at pgtype/hstore.go:403

	}
	return builder.String(), nil
}

// consumePairSeparator consumes the Hstore pair separator ", " or returns an error.
func (p *hstoreParser) consumePairSeparator() error {
	return p.consumeExpected2(',', ' ')
}

// consumeKVSeparator consumes the Hstore key/value separator "=>" or returns an error.
func (p *hstoreParser) consumeKVSeparator() error {
	return p.consumeExpected2('=', '>')
}

// consumeDoubleQuotedOrNull consumes the Hstore key/value separator "=>" or returns an error.
func (p *hstoreParser) consumeDoubleQuotedOrNull() (Text, error) {
	// peek at the next byte
	if p.atEnd() {
		return Text{}, errors.New("found end instead of value")
	}
	next := p.str[p.pos]
	if next == 'N' {
		// must be the exact string NULL: use consumeExpected2 twice
		err := p.consumeExpected2('N', 'U')
		if err != nil {
			return Text{}, err
		}
		err = p.consumeExpected2('L', 'L')
		if err != nil {
			return Text{}, err
		}
		return Text{String: "", Valid: false}, nil
	} else if next != '"' {
		return Text{}, unexpectedByteErr(next, '"')
	}

	// skip the double quote

View on GitHub (pinned to ec1a0befd2)