{"record":{"id":"e79193e7c06e09cd","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-client-w-e79193","errorCode":null,"errorMessage":"unable to create client: %w","messagePattern":"unable to create client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/falkordb/falkordb.go","lineNumber":95,"sourceCode":"\treturn nil\n}\n\nfunc (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {\n\tif err := r.validateTLS(); err != nil {\n\t\treturn nil, err\n\t}\n\n\tlogger, err := util.LoggerFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to get logger from ctx: %s\", err)\n\t}\n\tif r.TLS.InsecureSkipVerify {\n\t\tlogger.WarnContext(ctx, fmt.Sprintf(\"TLS certificate verification is skipped (insecureSkipVerify: true) for FalkorDB source %s. This exposes traffic for this source to man-in-the-middle attacks. Do not use in production.\", r.Name))\n\t}\n\n\tclient, err := initFalkorDBClient(ctx, tracer, r)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create client: %w\", err)\n\t}\n\n\tif err := client.Conn.Ping(ctx).Err(); err != nil {\n\t\tclient.Conn.Close()\n\t\treturn nil, fmt.Errorf(\"unable to connect successfully: %w\", err)\n\t}\n\n\ts := &Source{\n\t\tConfig: r,\n\t\tClient: client,\n\t}\n\treturn s, nil\n}\n\nfunc initFalkorDBClient(ctx context.Context, tracer trace.Tracer, r Config) (*falkordb.FalkorDB, error) {\n\t//nolint:all // Reassigned ctx\n\tctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, r.Name)\n\tdefer span.End()","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/falkordb/falkordb.go#L77-L113","documentation":"Initialize wraps any failure from initFalkorDBClient (which constructs the falkordb-go client via FalkorDBNew) with 'unable to create client'. The underlying wrapped error carries the real cause — typically a DNS resolution, address parsing, or client-construction failure.","triggerScenarios":"FalkorDBNew fails on an unparseable host:port (net.JoinHostPort output invalid), DNS resolution errors for the hostname, TLS config issues, or an unsupported/invalid option combination.","commonSituations":"Typoed hostnames; non-numeric or out-of-range port strings; DNS not resolving in container/K8s environments; firewall silently dropping connections during the initial dial.","solutions":["Read the wrapped %w error for the root cause (DNS, address, TLS)","Verify `host` and `port` in tools.yaml are correct and the port is numeric (e.g. \"6379\")","Test reachability: `redis-cli -h <host> -p <port> PING` or `nc -vz host port`","Check DNS inside the deployment environment (e.g. `nslookup <host>` in the pod)"],"exampleFix":"// before\n    host: falkordb.default.svc.cluster.local\n    port: 63aa79\n// after\n    host: falkordb.default.svc.cluster.local\n    port: \"6379\"","handlingStrategy":"try-catch","validationCode":"// preflight DNS + TCP before Initialize\nhost, port := cfg.Host, cfg.Port\nif net.ParseIP(host) == nil {\n    if _, err := net.LookupHost(host); err != nil {\n        return fmt.Errorf(\"cannot resolve falkordb host %q: %w\", host, err)\n    }\n}\nconn, err := net.DialTimeout(\"tcp\", net.JoinHostPort(host, port), 5*time.Second)\nif err != nil {\n    return fmt.Errorf(\"cannot reach falkordb at %s:%s: %w\", host, port, err)\n}\nconn.Close()","typeGuard":null,"tryCatchPattern":"// Go: inspect the wrapped cause and retry transient failures\nsrc, err := cfg.Initialize(ctx, tracer)\nif err != nil {\n    var derr *net.DNSError\n    if errors.As(err, &derr) {\n        return retryWithBackoff(ctx, initFn) // transient DNS\n    }\n    return err // config error: fix host/port, don't retry\n}","preventionTips":["Keep the port a numeric string (e.g. \"6379\") in tools.yaml","Verify hostname resolution inside the deployment environment","Read the wrapped %w error — 'unable to create client' is only the outer layer"],"tags":["network","falkordb","client-init","dns"],"backgroundTag":"client-initialization-failed","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"}