{"id":"bc8f80336d2307b3","repo":"jackc/pgx","slug":"scan-target-type-changed","errorCode":null,"errorMessage":"scan target type changed","messagePattern":"scan target type changed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/pgtype.go","lineNumber":1171,"sourceCode":"\t\t\t\tcodec = ByteaCodec{}\n\t\t\t}\n\t\t}\n\t\treturn &pointerEmptyInterfaceScanPlan{codec: codec, m: m, oid: oid, formatCode: formatCode}\n\t}\n\n\treturn &scanPlanFail{m: m, oid: oid, formatCode: formatCode}\n}\n\nfunc (m *Map) Scan(oid uint32, formatCode int16, src []byte, dst any) error {\n\tif dst == nil {\n\t\treturn nil\n\t}\n\n\tplan := m.PlanScan(oid, formatCode, dst)\n\treturn plan.Scan(src, dst)\n}\n\nvar ErrScanTargetTypeChanged = errors.New(\"scan target type changed\")\n\nfunc codecScan(codec Codec, m *Map, oid uint32, format int16, src []byte, dst any) error {\n\tscanPlan := codec.PlanScan(m, oid, format, dst)\n\tif scanPlan == nil {\n\t\treturn fmt.Errorf(\"PlanScan did not find a plan\")\n\t}\n\treturn scanPlan.Scan(src, dst)\n}\n\nfunc codecDecodeToTextFormat(codec Codec, m *Map, oid uint32, format int16, src []byte) (driver.Value, error) {\n\tif src == nil {\n\t\treturn nil, nil\n\t}\n\n\tif format == TextFormatCode {\n\t\treturn string(src), nil\n\t} else {\n\t\tvalue, err := codec.DecodeValue(m, oid, format, src)","sourceCodeStart":1153,"sourceCodeEnd":1189,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/pgtype.go#L1153-L1189","documentation":"Error \"scan target type changed\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/pgtype.go:1171 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"ec1a0befd22592cffffdeeb0a50311b506372f4c","analyzedAt":"2026-08-04T22:52:11.263Z","schemaVersion":2}