jackc/pgx · error

Record incomplete

Error message

Record incomplete: %w

What it means

Wrapping error from NewCompositeBinaryScanner: the source is too short to contain even the field count header (or is otherwise truncated), so the pgio reader reports an error while counting the 8-byte-minimum fields. The composite value on the wire is incomplete.

Solutions

  1. Treat as corrupted or truncated data — verify the column truly holds a composite type
  2. Check for protocol corruption or a server/driver version mismatch
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pgtype/composite.go:299 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/85273c36fc70e6b4. Report an issue: GitHub.

Appendix: source

Thrown at pgtype/composite.go:299

type CompositeBinaryScanner struct {
	m *Map
	r *pgio.Reader

	fieldCount int32
	fieldBytes []byte
	fieldOID   uint32
	err        error
}

// NewCompositeBinaryScanner a scanner over a binary encoded composite value.
func NewCompositeBinaryScanner(m *Map, src []byte) *CompositeBinaryScanner {
	r := pgio.NewReader(src)

	// Each field requires at least 8 bytes: 4 for the OID and 4 for the length prefix.
	fieldCount := r.Count(8)
	if err := r.Err(); err != nil {
		return &CompositeBinaryScanner{err: fmt.Errorf("Record incomplete: %w", err)}
	}

	return &CompositeBinaryScanner{
		m:          m,
		r:          r,
		fieldCount: int32(fieldCount),
	}
}

// Next advances the scanner to the next field. It returns false after the last field is read or an error occurs. After
// Next returns false, the Err method can be called to check if any errors occurred.
func (cfs *CompositeBinaryScanner) Next() bool {
	if cfs.err != nil {
		return false
	}

	if cfs.r.Remaining() == 0 {
		return false

View on GitHub (pinned to ec1a0befd2)