go-redis/redis · error

redis: unsupported pubsub message payload: %T

Error message

redis: unsupported pubsub message payload: %T

What it means

Error "redis: unsupported pubsub message payload: %T" thrown in go-redis/redis.

Source

Thrown at pubsub.go:463

					Payload: payload,
				}
				// Record PubSub message received
				otel.RecordPubSubMessage(ctx, cn, "received", channel, sharded)
				return msg, nil
			case []interface{}:
				ss := make([]string, len(payload))
				for i, s := range payload {
					ss[i] = s.(string)
				}
				msg := &Message{
					Channel:      channel,
					PayloadSlice: ss,
				}
				// Record PubSub message received
				otel.RecordPubSubMessage(ctx, cn, "received", channel, sharded)
				return msg, nil
			default:
				return nil, fmt.Errorf("redis: unsupported pubsub message payload: %T", payload)
			}
		case "pmessage":
			channel := reply[2].(string)
			msg := &Message{
				Pattern: reply[1].(string),
				Channel: channel,
				Payload: reply[3].(string),
			}
			// Record PubSub message received (pattern message, not sharded)
			otel.RecordPubSubMessage(ctx, cn, "received", channel, false)
			return msg, nil
		case "pong":
			return &Pong{
				Payload: reply[1].(string),
			}, nil
		default:
			return nil, fmt.Errorf("redis: unsupported pubsub message: %q", kind)
		}

View on GitHub (pinned to 36d97525cd)

Solutions

  1. Handle the payload type in the error with a type switch in your message processing
  2. Use ReceiveMessage for typed message delivery instead of raw payloads

When it happens

Trigger: Thrown at pubsub.go:463 when the library encounters an invalid state.

Common situations: Prefer the typed Channel()/ReceiveMessage APIs over raw payload inspection.


AI-assisted analysis of go-redis/redis@36d97525cd (2026-08-06). Data as JSON: /data/errors/5e1e034e2b7dafff.json. Report an issue: GitHub.