googleapis/mcp-toolbox · error

unable to create session: %v

Error message

unable to create session: %v

What it means

Initialize for the ScyllaDB source wraps any failure from initScyllaDBSession with this message. Any problem creating the gocql CQL session — bad hosts, auth, keyspace, protocol version — surfaces as 'unable to create session'. The original cause is embedded in %v.

Source

Thrown at internal/sources/scylladb/scylladb.go:73

	// LocalDC enables DC-aware token-aware load balancing. Required for
	// ScyllaDB Cloud connections (e.g. "AWS_US_EAST_1").
	LocalDC string `yaml:"localDC"`
	// DisableInitialHostLookup disables the initial host discovery step.
	// Set to true when connecting through a proxy, port-forward, or in
	// containerized environments where the cluster's internal IPs are not
	// reachable from the client.
	DisableInitialHostLookup bool   `yaml:"disableInitialHostLookup"`
	CAPath                   string `yaml:"caPath"`
	CertPath                 string `yaml:"certPath"`
	KeyPath                  string `yaml:"keyPath"`
	EnableHostVerification   bool   `yaml:"enableHostVerification"`
}

// Initialize implements sources.SourceConfig.
func (c Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
	session, err := initScyllaDBSession(ctx, tracer, c)
	if err != nil {
		return nil, fmt.Errorf("unable to create session: %v", err)
	}
	s := &Source{
		Config:  c,
		Session: session,
	}
	return s, nil
}

// SourceConfigType implements sources.SourceConfig.
func (c Config) SourceConfigType() string {
	return SourceType
}

var _ sources.SourceConfig = Config{}

type Source struct {
	Config
	Session *gocql.Session

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Read the wrapped cause: if it says 'password provided without a username', add a username or remove the password.
  2. If connection refused/timeout, check `hosts` are reachable: `cqlsh <host> 9042`.
  3. If keyspace errors, create the keyspace first or fix the `keyspace` field spelling.
  4. Match `protoVersion` to the server (ScyllaDB supports v3/v4; set explicitly if negotiation fails).
  5. Verify username/password against the ScyllaDB authenticator settings.

Example fix

// before
sources:
  my-scylla:
    kind: scylladb
    hosts: ["10.0.0.1:9042"]
    password: secret
// after
sources:
  my-scylla:
    kind: scylladb
    hosts: ["10.0.0.1:9042"]
    username: cassandra
    password: secret
Defensive patterns

Strategy: validation

Validate before calling

# Validate ScyllaDB source config before startup
python3 - <<'EOF'
import os, socket
hosts = os.environ.get('SCYLLA_HOSTS','').split(',')
user, pw = os.environ.get('SCYLLA_USER',''), os.environ.get('SCYLLA_PASS','')
assert not (pw and not user), "password set without username"
for h in hosts:
    host, _, port = h.partition(':')
    s = socket.socket(); s.settimeout(3)
    s.connect((host, int(port or 9042))); s.close()
print("scylla config OK")
EOF

Prevention

When it happens

Trigger: Config.Initialize calls initScyllaDBSession, which validates config, builds a gocql.ClusterConfig, and calls cluster.CreateSession(); any returned error is wrapped here. Includes both the config-validation error and the session-creation error.

Common situations: Password set without username (config validation failure); unreachable contact points; wrong protoVersion for the server; keyspace does not exist; authentication credentials rejected.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/5f8a807e4ce4b8bc. Report an issue: GitHub.