jackc/pgx · error

cannot scan NULL into *string

Error message

cannot scan NULL into *string

What it means

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

Source

Thrown at pgtype/builtin_wrappers.go:387

		return fmt.Errorf("cannot scan NULL into *float64")
	}

	*w = float64Wrapper(v.Float64)

	return nil
}

func (w float64Wrapper) Float64Value() (Float8, error) {
	return Float8{Float64: float64(w), Valid: true}, nil
}

type stringWrapper string

func (w stringWrapper) SkipUnderlyingTypePlan() {}

func (w *stringWrapper) ScanText(v Text) error {
	if !v.Valid {
		return fmt.Errorf("cannot scan NULL into *string")
	}

	*w = stringWrapper(v.String)
	return nil
}

func (w stringWrapper) TextValue() (Text, error) {
	return Text{String: string(w), Valid: true}, nil
}

type timeWrapper time.Time

func (w *timeWrapper) ScanDate(v Date) error {
	if !v.Valid {
		return fmt.Errorf("cannot scan NULL into *time.Time")
	}

	switch v.InfinityModifier {

View on GitHub (pinned to ec1a0befd2)

When it happens

Trigger: Thrown at pgtype/builtin_wrappers.go:387 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/887a5d461e07af38.json. Report an issue: GitHub.