{"record":{"id":"934e7f5d04d7eca1","repo":"googleapis/mcp-toolbox","slug":"invalid-cassandra-configuration-password-provided","errorCode":null,"errorMessage":"invalid Cassandra configuration: password provided without a username","messagePattern":"invalid Cassandra configuration: password provided without a username","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/cassandra/cassandra.go","lineNumber":132,"sourceCode":"\t\tout = append(out, row)\n\t}\n\n\tif err := iter.Close(); err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to parse rows: %w\", err)\n\t}\n\treturn out, nil\n}\n\nvar _ sources.Source = &Source{}\n\nfunc initCassandraSession(ctx context.Context, tracer trace.Tracer, c Config) (*gocql.Session, error) {\n\t//nolint:all // Reassigned ctx\n\tctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, c.Name)\n\tdefer span.End()\n\n\t// Validate authentication configuration\n\tif c.Password != \"\" && c.Username == \"\" {\n\t\treturn nil, fmt.Errorf(\"invalid Cassandra configuration: password provided without a username\")\n\t}\n\n\tcluster := gocql.NewCluster(c.Hosts...)\n\tcluster.ProtoVersion = c.ProtoVersion\n\tcluster.Keyspace = c.Keyspace\n\n\t// Configure authentication if username is provided\n\tif c.Username != \"\" {\n\t\tcluster.Authenticator = gocql.PasswordAuthenticator{\n\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,","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/cassandra/cassandra.go#L114-L150","documentation":"initCassandraSession validates auth configuration before connecting. Providing a Password with an empty Username is treated as a misconfiguration and rejected immediately with this static message.","triggerScenarios":"Constructing cassandra.Config with Password set but Username empty, then calling Initialize.","commonSituations":"Config YAML missing the username field, env var not wired into username, password-only auth assumed (Cassandra requires both).","solutions":["Set the Username field alongside Password in the config.","Check the YAML/config keys are spelled correctly so the username is parsed.","If the cluster truly needs no auth, remove the Password too.","Add a config sanity check in your deployment pipeline."],"exampleFix":"// before\nc := cassandra.Config{Hosts: hosts, Password: \"secret\"}\n// after\nc := cassandra.Config{Hosts: hosts, Username: \"cassandra\", Password: \"secret\"}","handlingStrategy":"validation","validationCode":"if cfg.Password != \"\" && cfg.Username == \"\" {\n    return errors.New(\"password provided without a username\")\n}","typeGuard":null,"tryCatchPattern":"_, err := cfg.Initialize(ctx, tracer)\nif err != nil && strings.Contains(err.Error(), \"invalid Cassandra configuration\") {\n    // fix config, do not retry\n}","preventionTips":["Always set username and password together.","Validate config fields before passing to Initialize.","Use config templates/tests that enforce both fields."],"tags":["cassandra","configuration","authentication"],"backgroundTag":"invalid-auth-config","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"}