jackc/pgx · error
PlanScan did not find a plan
Error message
PlanScan did not find a plan
What it means
codecScan is the fallback path that asks a codec directly for a scan plan; this guard fires when the codec's PlanScan returns nil for the given destination — the codec cannot scan that Go type in that format. It mirrors the Map-level scanPlanFail but without its descriptive context.
Solutions
- Scan into a destination type the codec supports
- Wrap the destination with a scan-plan wrapper registered via TryWrapScanPlanFunc
- Use a different format code (text vs binary) for the column
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at pgtype/pgtype.go:1176 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/1276d9d8889269e4.
Report an issue: GitHub.
Appendix: source
Thrown at pgtype/pgtype.go:1176
return &scanPlanFail{m: m, oid: oid, formatCode: formatCode}
}
func (m *Map) Scan(oid uint32, formatCode int16, src []byte, dst any) error {
if dst == nil {
return nil
}
plan := m.PlanScan(oid, formatCode, dst)
return plan.Scan(src, dst)
}
var ErrScanTargetTypeChanged = errors.New("scan target type changed")
func codecScan(codec Codec, m *Map, oid uint32, format int16, src []byte, dst any) error {
scanPlan := codec.PlanScan(m, oid, format, dst)
if scanPlan == nil {
return fmt.Errorf("PlanScan did not find a plan")
}
return scanPlan.Scan(src, dst)
}
func codecDecodeToTextFormat(codec Codec, m *Map, oid uint32, format int16, src []byte) (driver.Value, error) {
if src == nil {
return nil, nil
}
if format == TextFormatCode {
return string(src), nil
} else {
value, err := codec.DecodeValue(m, oid, format, src)
if err != nil {
return nil, err
}
buf, err := m.Encode(oid, TextFormatCode, value, nil)
if err != nil {View on GitHub (pinned to ec1a0befd2)