jackc/pgx · error

cannot scan NULL into CompositeFields

Error message

cannot scan NULL into CompositeFields

What it means

Error "cannot scan NULL into CompositeFields" thrown in jackc/pgx.

Source

Thrown at pgtype/composite.go:616

	return src
}

// CompositeFields represents the values of a composite value. It can be used as an encoding source or as a scan target.
// It cannot scan a NULL, but the composite fields can be NULL.
type CompositeFields []any

func (cf CompositeFields) SkipUnderlyingTypePlan() {}

func (cf CompositeFields) IsNull() bool {
	return cf == nil
}

func (cf CompositeFields) Index(i int) any {
	return cf[i]
}

func (cf CompositeFields) ScanNull() error {
	return fmt.Errorf("cannot scan NULL into CompositeFields")
}

func (cf CompositeFields) ScanIndex(i int) any {
	return cf[i]
}

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/composite.go:616 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/083da3537983dfcc.json. Report an issue: GitHub.