{"id":"336f0f047367e4c6","repo":"jackc/pgx","slug":"cannot-scan-t","errorCode":null,"errorMessage":"cannot scan %T","messagePattern":"cannot scan %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pgtype/bits.go","lineNumber":47,"sourceCode":"}\n\n// BitsValue implements the [BitsValuer] interface.\nfunc (b Bits) BitsValue() (Bits, error) {\n\treturn b, nil\n}\n\n// Scan implements the [database/sql.Scanner] interface.\nfunc (dst *Bits) Scan(src any) error {\n\tif src == nil {\n\t\t*dst = Bits{}\n\t\treturn nil\n\t}\n\n\tif src, ok := src.(string); ok {\n\t\treturn scanPlanTextAnyToBitsScanner{}.Scan([]byte(src), dst)\n\t}\n\n\treturn fmt.Errorf(\"cannot scan %T\", src)\n}\n\n// Value implements the [database/sql/driver.Valuer] interface.\nfunc (src Bits) Value() (driver.Value, error) {\n\tif !src.Valid {\n\t\treturn nil, nil\n\t}\n\n\tbuf, err := BitsCodec{}.PlanEncode(nil, 0, TextFormatCode, src).Encode(src, nil)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn string(buf), err\n}\n\ntype BitsCodec struct{}\n\nfunc (BitsCodec) FormatSupported(format int16) bool {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/jackc/pgx/blob/ec1a0befd22592cffffdeeb0a50311b506372f4c/pgtype/bits.go#L29-L65","documentation":"Error \"cannot scan %T\" thrown in jackc/pgx.","triggerScenarios":"Thrown at pgtype/bits.go:47 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}