{"record":{"id":"4ff729f28c283e37","repo":"t8y2/dbx","slug":"cassandra-host-is-required","errorCode":null,"errorMessage":"Cassandra host is required","messagePattern":"Cassandra host is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/cassandra-go/config.go","lineNumber":103,"sourceCode":"\tif err != nil {\n\t\treturn cassandraConfig{}, err\n\t}\n\tfor key, values := range urlParams {\n\t\tparams[key] = values\n\t}\n\tif err := applyCassandraURLParams(&config, params); err != nil {\n\t\treturn cassandraConfig{}, err\n\t}\n\tif config.configFile != \"\" {\n\t\tif err := applyCassandraConfigFile(&config, config.configFile); err != nil {\n\t\t\treturn cassandraConfig{}, err\n\t\t}\n\t}\n\tif err := config.finalize(); err != nil {\n\t\treturn cassandraConfig{}, err\n\t}\n\tif len(config.hosts) == 0 && config.secureConnectBundle == \"\" {\n\t\treturn cassandraConfig{}, fmt.Errorf(\"Cassandra host is required\")\n\t}\n\tif len(config.hosts) > 0 && !config.disableInitialHostLookup && allLoopbackHosts(config.hosts) {\n\t\tconfig.disableInitialHostLookup = true\n\t}\n\treturn config, nil\n}\n\nfunc applyConnectionString(config *cassandraConfig, params url.Values, raw string) error {\n\tvalue := strings.TrimSpace(raw)\n\tvalue = strings.TrimPrefix(value, \"jdbc:\")\n\tif !strings.Contains(value, \"://\") {\n\t\treturn fmt.Errorf(\"unsupported Cassandra connection string: %s\", raw)\n\t}\n\tparsed, err := url.Parse(value)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"invalid Cassandra connection string: %w\", err)\n\t}\n\tif parsed.Scheme != \"cassandra\" {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/cassandra-go/config.go#L85-L121","documentation":"parseCassandraConfig rejects the final config when no hosts were configured and no secure-connect-bundle was provided: there is no way to know which Cassandra cluster to contact. finalize() has already passed, so the config is internally valid but has no connection target.","triggerScenarios":"Calling parseCassandraConfig (via driver open/config parsing) with an empty hosts list, no 'host'/'hosts' JDBC-style parameter, no URL host portion, and no secure-connect-bundle parameter or file-derived bundle path.","commonSituations":"Migrating from a JDBC string and forgetting the host; Astra users removing the host but not supplying the secure connect bundle; config file parsed but keys misspelled (e.g. 'hostname' instead of 'host'); environment-driven config where the env var is empty.","solutions":["Add the host(s): set the host/hosts parameter or include host:port in the connection URL.","For Astra/DataStax, supply the secure-connect-bundle parameter pointing to the downloaded zip.","Check spelling of config keys and that the config file was actually found (missing files are ignored for JDBC compatibility).","Verify env vars feeding the config are non-empty at runtime."],"exampleFix":"// before\ncfg := map[string]string{\"keyspace\": \"sales\"} // no host, no bundle\n// after\ncfg := map[string]string{\"host\": \"10.0.0.5,10.0.0.6\", \"keyspace\": \"sales\"}\n// or: cfg[\"secure-connect-bundle\"] = \"/path/to/secure-connect.zip\"","handlingStrategy":"validation","validationCode":"hosts := cfg.Hosts\nbundle := cfg.SecureConnectBundle\nif len(hosts) == 0 && bundle == \"\" {\n    return fmt.Errorf(\"cassandra config requires hosts or secure-connect-bundle before opening\")\n}","typeGuard":null,"tryCatchPattern":"c, err := connector.Open(dsn)\nif err != nil && strings.Contains(err.Error(), \"Cassandra host is required\") {\n    return nil, fmt.Errorf(\"no connection target: set host/hosts or secure-connect-bundle (check key spelling and env vars): %w\", err)\n}","preventionTips":["Require host or secure-connect-bundle in your app's config schema validation.","For Astra, always ship the secure connect bundle alongside credentials.","Check that config files exist and keys match the documented names (missing files are silently ignored).","Fail fast at startup with a clear message if the host env var is empty."],"tags":["configuration","cassandra","missing-parameter"],"backgroundTag":"missing-required-config","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}