{"record":{"id":"7c9dc0f1b8692ecf","repo":"jackc/pgx","slug":"cannot-scan-s-oid-d-in-v-format-into-t","errorCode":null,"errorMessage":"cannot scan %s (OID %d) in %v format into %T","messagePattern":"cannot scan (.+?) \\(OID (.+?)\\) in (.+?) format into %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/pgtype.go","lineNumber":483,"sourceCode":"\n\tvar format string\n\tswitch plan.formatCode {\n\tcase TextFormatCode:\n\t\tformat = \"text\"\n\tcase BinaryFormatCode:\n\t\tformat = \"binary\"\n\tdefault:\n\t\tformat = fmt.Sprintf(\"unknown %d\", plan.formatCode)\n\t}\n\n\tvar dataTypeName string\n\tif t, ok := plan.m.TypeForOID(plan.oid); ok {\n\t\tdataTypeName = t.Name\n\t} else {\n\t\tdataTypeName = \"unknown type\"\n\t}\n\n\treturn fmt.Errorf(\"cannot scan %s (OID %d) in %v format into %T\", dataTypeName, plan.oid, format, dst)\n}\n\n// TryWrapScanPlanFunc is a function that tries to create a wrapper plan for target. If successful it returns a plan\n// that will convert the target passed to Scan and then call the next plan. nextTarget is target as it will be converted\n// by plan. It must be used to find another suitable ScanPlan. When it is found SetNext must be called on plan for it\n// to be usabled. ok indicates if a suitable wrapper was found.\ntype TryWrapScanPlanFunc func(target any) (plan WrappedScanPlanNextSetter, nextTarget any, ok bool)\n\ntype pointerPointerScanPlan struct {\n\tdstType reflect.Type\n\tnext    ScanPlan\n}\n\nfunc (plan *pointerPointerScanPlan) SetNext(next ScanPlan) { plan.next = next }\n\nfunc (plan *pointerPointerScanPlan) Scan(src []byte, dst any) error {\n\tdstValue := reflect.ValueOf(dst)\n\tif dstValue.Kind() != reflect.Pointer || dstValue.IsNil() {","sourceCodeStart":465,"sourceCodeEnd":501,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/pgtype.go#L465-L501","documentation":"This is the error produced by scanPlanFail, the plan Map.PlanScan returns when no codec can handle the combination of PostgreSQL type, wire format, and destination Go type. It names the type (or 'unknown type' if the OID isn't registered), its OID, the format, and the destination type, so the unsupported leg of the lookup is identifiable.","triggerScenarios":"Thrown at pgtype/pgtype.go:483 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Scan into a supported Go type for that column (e.g. *string for unknown OIDs)","Register a custom codec or type mapping for the OID with RegisterType/TryWrapEncodePlanFunc","Cast the column in SQL to a type with a known codec","Scan into pgtype's generic types (Text, Numeric) or use driver.Value"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}