{"record":{"id":"0b00da1aee200b10","repo":"googleapis/mcp-toolbox","slug":"unable-to-connect-to-redis-s","errorCode":null,"errorMessage":"unable to connect to redis: %s","messagePattern":"unable to connect to redis: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/redis/redis.go","lineNumber":147,"sourceCode":"\t\tclient = clusterClient\n\t\treturn client, nil\n\t}\n\n\t// Create a new Redis client\n\tstandaloneClient := redis.NewClient(&redis.Options{\n\t\tAddr:                       r.Address[0],\n\t\tPoolSize:                   10,\n\t\tConnMaxIdleTime:            60 * time.Second,\n\t\tMinIdleConns:               1,\n\t\tDB:                         r.Database,\n\t\tCredentialsProviderContext: authFn,\n\t\tUsername:                   r.Username,\n\t\tPassword:                   r.Password,\n\t\tTLSConfig:                  tlsConfig,\n\t})\n\t_, err = standaloneClient.Ping(ctx).Result()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to connect to redis: %s\", err)\n\t}\n\tclient = standaloneClient\n\treturn client, nil\n}\n\nvar _ sources.Source = &Source{}\n\ntype Source struct {\n\tConfig\n\tClient RedisClient\n}\n\nfunc (s *Source) IsReadOnly() bool {\n\treturn false\n}\n\nfunc (s *Source) SourceType() string {\n\treturn SourceType","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/redis/redis.go#L129-L165","documentation":"This error wraps the failure from a standalone (non-cluster) go-redis client Ping during source initialization. After building redis.UniversalClient with the configured address, username, password, and TLS settings, the toolbox pings the server; any failure (network, auth, TLS) aborts source creation. The wrapped message carries the specific cause.","triggerScenarios":"Redis source with clusterMode=false (default); Initialize calls standaloneClient.Ping(ctx) which fails because the server is down, address is wrong, credentials are invalid, or TLS settings mismatch.","commonSituations":"Redis not running or wrong `address` port; missing/incorrect `password` (NOAUTH/WRONGPASS errors); using TLS config against a plaintext server or vice versa; Redis behind VPC/Security Group blocking the toolbox host; Redis currently loading RDB (LOADING error).","solutions":["Test connectivity manually: `redis-cli -h <host> -p <port> ping` from the machine running the toolbox.","Confirm `password`/`username` match Redis `requirepass` or ACL user; WRONGPASS means credentials are wrong.","Match TLS settings to the server: remove TLS config for plaintext servers, add server CA for TLS-enabled servers.","Check the address scheme — the address must include the port and be reachable (no typos like 6379 vs 7379).","If Redis is still starting (LOADING), add retry/backoff or wait for the instance to be ready."],"exampleFix":"// before\nsources:\n  my-redis:\n    kind: redis\n    address: localhost:6379\n    useServerCA: true\n// after (plaintext local redis, no TLS)\nsources:\n  my-redis:\n    kind: redis\n    address: localhost:6379","handlingStrategy":"validation","validationCode":"// Verify the standalone Redis instance before starting the toolbox\nredis-cli -h \"${REDIS_HOST:-localhost}\" -p \"${REDIS_PORT:-6379}\" \\\n  $( [ -n \"$REDIS_PASSWORD\" ] && echo \"-a $REDIS_PASSWORD\" ) ping\necho $REDIS_ADDRESS # must be host:port, e.g. localhost:6379","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always smoke-test the address with redis-cli ping from the toolbox host first.","Match TLS config exactly to the server mode; wrong TLS settings cause opaque ping failures.","For Redis 6+ ACL, set both username and password; for requirepass-only, password alone suffices.","Handle LOADING at startup: wait for the instance to be ready before launching the toolbox."],"tags":["redis","connection","ping","go"],"backgroundTag":"connection-refused","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}