{"record":{"id":"51efb76cc9065ab8","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-session-v","errorCode":null,"errorMessage":"unable to create session: %v","messagePattern":"unable to create session: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/cassandra/cassandra.go","lineNumber":62,"sourceCode":"type Config struct {\n\tName                   string   `yaml:\"name\" validate:\"required\"`\n\tType                   string   `yaml:\"type\" validate:\"required\"`\n\tHosts                  []string `yaml:\"hosts\" validate:\"required\"`\n\tKeyspace               string   `yaml:\"keyspace\"`\n\tProtoVersion           int      `yaml:\"protoVersion\"`\n\tUsername               string   `yaml:\"username\"`\n\tPassword               string   `yaml:\"password\"`\n\tCAPath                 string   `yaml:\"caPath\"`\n\tCertPath               string   `yaml:\"certPath\"`\n\tKeyPath                string   `yaml:\"keyPath\"`\n\tEnableHostVerification bool     `yaml:\"enableHostVerification\"`\n}\n\n// Initialize implements sources.SourceConfig.\nfunc (c Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {\n\tsession, err := initCassandraSession(ctx, tracer, c)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create session: %v\", err)\n\t}\n\ts := &Source{\n\t\tConfig:  c,\n\t\tSession: session,\n\t}\n\treturn s, nil\n}\n\n// SourceConfigType implements sources.SourceConfig.\nfunc (c Config) SourceConfigType() string {\n\treturn SourceType\n}\n\nvar _ sources.SourceConfig = Config{}\n\ntype Source struct {\n\tConfig\n\tSession *gocql.Session","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/cassandra/cassandra.go#L44-L80","documentation":"This error wraps any failure that occurs while creating the Cassandra session during source initialization in the MCP Toolbox. Config.Initialize calls initCassandraSession, and if the cluster cannot be contacted or configured incorrectly, the underlying gocql error is wrapped with this message.","triggerScenarios":"Calling Initialize on a cassandra.Config when initCassandraSession fails: invalid auth config, unreachable hosts, bad protocol version, or keyspace issues.","commonSituations":"Cassandra cluster down or wrong host/port, wrong ProtoVersion for the server, keyspace that does not exist, network/firewall blocking the CQL port 9042.","solutions":["Check that the Cassandra cluster is reachable from the toolbox host (hosts list, port 9042, firewall).","Verify username/password are both set together and correct.","Confirm ProtoVersion matches your Cassandra/ScyllaDB server version.","Verify the keyspace exists; omit it if you don't need one.","Inspect the wrapped inner error (%v) for the root cause."],"exampleFix":"// before\nc := cassandra.Config{Hosts: []string{\"wrong-host\"}}\n// after\nc := cassandra.Config{Hosts: []string{\"127.0.0.1\"}, Username: \"cassandra\", Password: \"cassandra\", Keyspace: \"myks\"}","handlingStrategy":"validation","validationCode":"if len(cfg.Hosts) == 0 { return errors.New(\"cassandra hosts required\") }\nif cfg.Password != \"\" && cfg.Username == \"\" { return errors.New(\"password requires username\") }","typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil {\n    var netErr net.Error\n    if errors.As(err, &netErr) { /* handle connectivity */ }\n    return fmt.Errorf(\"cassandra init failed: %w\", err)\n}","preventionTips":["Pre-validate hosts, username/password pairing before Initialize.","Smoke-test connectivity to the CQL port from the deployment environment.","Pin ProtoVersion to a value your server supports."],"tags":["cassandra","initialization","connection"],"backgroundTag":"session-creation-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"}