jackc/pgx · error
cannot scan %v to *net.IP
Error message
cannot scan %v to *net.IP
What it means
Error "cannot scan %v to *net.IP" thrown in jackc/pgx.
Source
Thrown at pgtype/builtin_wrappers.go:553
}
ones, _ := w.Mask.Size()
return netip.PrefixFrom(ip, ones), nil
}
type netIPWrapper net.IP
func (w netIPWrapper) SkipUnderlyingTypePlan() {}
func (w *netIPWrapper) ScanNetipPrefix(v netip.Prefix) error {
if !v.IsValid() {
*w = nil
return nil
}
if v.Addr().BitLen() != v.Bits() {
return fmt.Errorf("cannot scan %v to *net.IP", v)
}
*w = netIPWrapper(v.Addr().AsSlice())
return nil
}
func (w netIPWrapper) NetipPrefixValue() (netip.Prefix, error) {
if w == nil {
return netip.Prefix{}, nil
}
addr, ok := netip.AddrFromSlice([]byte(w))
if !ok {
return netip.Prefix{}, errors.New("invalid net.IP")
}
return netip.PrefixFrom(addr, addr.BitLen()), nil
}View on GitHub (pinned to ec1a0befd2)
When it happens
Trigger: Thrown at pgtype/builtin_wrappers.go:553 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/f047ba1c8c308b04.json.
Report an issue: GitHub.