{"record":{"id":"0166433d956c920a","repo":"hibiken/asynq","slug":"inspeq-unsupported-redisconnopt-type-t","errorCode":null,"errorMessage":"inspeq: unsupported RedisConnOpt type %T","messagePattern":"inspeq: unsupported RedisConnOpt type %T","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"inspector.go","lineNumber":33,"sourceCode":"\t\"github.com/hibiken/asynq/internal/errors\"\n\t\"github.com/hibiken/asynq/internal/rdb\"\n\t\"github.com/redis/go-redis/v9\"\n)\n\n// Inspector is a client interface to inspect and mutate the state of\n// queues and tasks.\ntype Inspector struct {\n\trdb *rdb.RDB\n\t// When an Inspector has been created with an existing Redis connection, we do\n\t// not want to close it.\n\tsharedConnection bool\n}\n\n// New returns a new instance of Inspector.\nfunc NewInspector(r RedisConnOpt) *Inspector {\n\tc, ok := r.MakeRedisClient().(redis.UniversalClient)\n\tif !ok {\n\t\tpanic(fmt.Sprintf(\"inspeq: unsupported RedisConnOpt type %T\", r))\n\t}\n\tinspector := NewInspectorFromRedisClient(c)\n\tinspector.sharedConnection = false\n\treturn inspector\n}\n\n// NewInspectorFromRedisClient returns a new instance of Inspector given a redis.UniversalClient\n// Warning: The underlying redis connection pool will not be closed by Asynq, you are responsible for closing it.\nfunc NewInspectorFromRedisClient(c redis.UniversalClient) *Inspector {\n\treturn &Inspector{\n\t\trdb:              rdb.NewRDB(c),\n\t\tsharedConnection: true,\n\t}\n}\n\n// Close closes the connection with redis.\nfunc (i *Inspector) Close() error {\n\tif i.sharedConnection {","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/hibiken/asynq/blob/d135f1439bee74e989b7f9b41ecd542cc87f024a/inspector.go#L15-L51","documentation":"asynq.NewInspector panics when the given RedisConnOpt's MakeRedisClient() does not yield a redis.UniversalClient. The Inspector requires a go-redis UniversalClient to perform its Redis-backed inspection commands, and any incompatible connection-option implementation causes this immediate panic instead of a returned error.","triggerScenarios":"Constructing asynq.NewInspector with a custom RedisConnOpt whose MakeRedisClient returns nil or a non-go-redis client; passing a wrapper type; a third-party conn option that doesn't adapt to asynq's expected interface.","commonSituations":"Copy-pasting a config object built for another Redis library (e.g. redigo conn) into asynq; custom conn opts that return *redis.Client from an incompatible go-redis major version; misconfiguring DI containers that supply the wrong type.","solutions":["Use asynq.RedisClientOpt, RedisClusterClientOpt, or RedisFailoverClientOpt when creating the Inspector","If you already have a go-redis UniversalClient, call asynq.NewInspectorFromRedisClient instead","Make your custom RedisConnOpt's MakeRedisClient return a value implementing redis.UniversalClient","Verify go-redis version compatibility (the UniversalClient interface must match what asynq was built against)"],"exampleFix":"// before\ninspector := asynq.NewInspector(myRedigoBasedOpt{})\n\n// after\ninspector := asynq.NewInspector(asynq.RedisClientOpt{Addr: \"localhost:6379\"})","handlingStrategy":"validation","validationCode":"opt := asynq.RedisClientOpt{Addr: \":6379\"}\nif _, ok := opt.MakeRedisClient().(redis.UniversalClient); !ok {\n    log.Fatal(\"inspector conn opt must yield redis.UniversalClient\")\n}\ninspector := asynq.NewInspector(opt)","typeGuard":"func connOptIsUniversalClient(r asynq.RedisConnOpt) bool {\n    _, ok := r.MakeRedisClient().(redis.UniversalClient)\n    return ok\n}","tryCatchPattern":null,"preventionTips":["Use the standard asynq conn-opt types for the Inspector","Use NewInspectorFromRedisClient with an existing go-redis UniversalClient","Verify custom MakeRedisClient implementations return go-redis client types, not wrappers","Add a construction test that builds the Inspector with your production conn opt"],"tags":["redis","panic","configuration","go"],"backgroundTag":"type-mismatch","analyzedSha":"d135f1439bee74e989b7f9b41ecd542cc87f024a","analyzedAt":"2026-09-07T19:02:34.660Z","contentChangedAt":"2026-09-07T19:02:34.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}