jackc/pgx · error
cannot scan into non-pointer or nil destinations %T
Error message
cannot scan into non-pointer or nil destinations %T
What it means
Error "cannot scan into non-pointer or nil destinations %T" thrown in jackc/pgx.
Source
Thrown at pgtype/json.go:216
func (s *scanPlanJSONToJSONUnmarshal) Scan(src []byte, dst any) error {
if src == nil {
dstValue := reflect.ValueOf(dst)
if dstValue.Kind() == reflect.Pointer {
el := dstValue.Elem()
switch el.Kind() {
case reflect.Pointer, reflect.Slice, reflect.Map, reflect.Interface:
el.Set(reflect.Zero(el.Type()))
return nil
}
}
return fmt.Errorf("cannot scan NULL into %T", dst)
}
v := reflect.ValueOf(dst)
if v.Kind() != reflect.Pointer || v.IsNil() {
return fmt.Errorf("cannot scan into non-pointer or nil destinations %T", dst)
}
elem := v.Elem()
elem.Set(reflect.Zero(elem.Type()))
return s.unmarshal(src, dst)
}
func (c *JSONCodec) DecodeDatabaseSQLValue(m *Map, oid uint32, format int16, src []byte) (driver.Value, error) {
if src == nil {
return nil, nil
}
dstBuf := make([]byte, len(src))
copy(dstBuf, src)
return dstBuf, nil
}
View on GitHub (pinned to ec1a0befd2)
When it happens
Trigger: Thrown at pgtype/json.go:216 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/39f64572b26566f4.json.
Report an issue: GitHub.