{"record":{"id":"c903b92518a2d086","repo":"googleapis/mcp-toolbox","slug":"failed-to-create-cassandra-session-w","errorCode":null,"errorMessage":"failed to create Cassandra session: %w","messagePattern":"failed to create Cassandra session: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/cassandra/cassandra.go","lineNumber":160,"sourceCode":"\t\t\tUsername: c.Username,\n\t\t\tPassword: c.Password,\n\t\t}\n\t}\n\n\t// Configure SSL options if any are specified\n\tif c.CAPath != \"\" || c.CertPath != \"\" || c.KeyPath != \"\" || c.EnableHostVerification {\n\t\tcluster.SslOpts = &gocql.SslOptions{\n\t\t\tCaPath:                 c.CAPath,\n\t\t\tCertPath:               c.CertPath,\n\t\t\tKeyPath:                c.KeyPath,\n\t\t\tEnableHostVerification: c.EnableHostVerification,\n\t\t}\n\t}\n\n\t// Create session\n\tsession, err := cluster.CreateSession()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to create Cassandra session: %w\", err)\n\t}\n\treturn session, nil\n}\n","sourceCodeStart":142,"sourceCodeEnd":164,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/cassandra/cassandra.go#L142-L164","documentation":"cluster.CreateSession() in initCassandraSession failed to establish a session to the Cassandra cluster. This is the underlying connection step; the gocql error is wrapped with %w for direct unwrapping with errors.Is/As.","triggerScenarios":"Calling Initialize when gocql cannot dial any host: connection refused, TLS handshake failure, authentication rejected, or protocol version mismatch.","commonSituations":"Cluster down, wrong port, wrong credentials, TLS misconfiguration, unsupported ProtoVersion, DNS resolution failures.","solutions":["Verify hosts and port (default 9042) are correct and reachable.","Confirm credentials are valid (cqlsh login works).","Check ProtoVersion compatibility with the server.","Inspect TLS/SSL settings on the cluster config.","Use errors.Unwrap to get the root gocql error."],"exampleFix":"// before\ncluster.ProtoVersion = 4 // server only supports 3\n// after\ncluster.ProtoVersion = 3","handlingStrategy":"retry","validationCode":"conn, err := net.DialTimeout(\"tcp\", host+\":9042\", 3*time.Second)\nif err != nil { return fmt.Errorf(\"cassandra unreachable: %w\", err) }\nconn.Close()","typeGuard":null,"tryCatchPattern":"_, err := cfg.Initialize(ctx, tracer)\nif err != nil {\n    // retry with backoff; unwrap for gocql root cause\n    return fmt.Errorf(\"session failed: %w\", errors.Unwrap(err))\n}","preventionTips":["Verify host/port reachability before init.","Confirm credentials with cqlsh first.","Keep ProtoVersion consistent with server version."],"tags":["cassandra","connection","session"],"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"}