{"id":"ba333d02fd605931","repo":"go-redis/redis","slug":"cannot-scan-redis-result-s-into-struct-field-s","errorCode":null,"errorMessage":"cannot scan redis.result %s into struct field %s.%s of type %s, error-%s","messagePattern":"cannot scan redis\\.result (.+?) into struct field (.+?)\\.(.+?) of type (.+?), error-(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/hscan/structmap.go","lineNumber":123,"sourceCode":"\n\tif isPtr && v.Type().NumMethod() > 0 && v.CanInterface() {\n\t\tswitch scan := v.Interface().(type) {\n\t\tcase Scanner:\n\t\t\treturn scan.ScanRedis(value)\n\t\tcase encoding.TextUnmarshaler:\n\t\t\treturn scan.UnmarshalText(util.StringToBytes(value))\n\t\tcase encoding.BinaryUnmarshaler:\n\t\t\treturn scan.UnmarshalBinary(util.StringToBytes(value))\n\t\t}\n\t}\n\n\tif isPtr {\n\t\tv = v.Elem()\n\t}\n\n\tif err := field.fn(v, value); err != nil {\n\t\tt := s.value.Type()\n\t\treturn fmt.Errorf(\"cannot scan redis.result %s into struct field %s.%s of type %s, error-%s\",\n\t\t\tvalue, t.Name(), t.Field(field.index).Name, t.Field(field.index).Type, err.Error())\n\t}\n\treturn nil\n}\n","sourceCodeStart":105,"sourceCodeEnd":128,"githubUrl":"https://github.com/go-redis/redis/blob/36d97525cd8076aed67cddf54778e9ea84550929/internal/hscan/structmap.go#L105-L128","documentation":"Error \"cannot scan redis.result %s into struct field %s.%s of type %s, error-%s\" thrown in go-redis/redis.","triggerScenarios":"Thrown at internal/hscan/structmap.go:123 when the library encounters an invalid state.","commonSituations":"Mirror the hash schema in the Go struct exactly and test scanning with representative data.","solutions":["Ensure the struct field type matches the Redis value representation (e.g. string field for string values)","Add a redis tag or BinaryUnmarshaler to control conversion for mismatched fields"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"36d97525cd8076aed67cddf54778e9ea84550929","analyzedAt":"2026-08-06T01:08:27.376Z","schemaVersion":2}