{"record":{"id":"a91330a76ed60b14","repo":"openzipkin/zipkin","slug":"keyspace-null","errorCode":null,"errorMessage":"keyspace == null","messagePattern":"keyspace == null","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/CassandraStorageBuilder.java","lineNumber":148,"sourceCode":"    this.password = password;\n    return (B) this;\n  }\n\n  /** Use ssl for connection. Defaults to false. */\n  public B useSsl(boolean useSsl) {\n    this.useSsl = useSsl;\n    return (B) this;\n  }\n\n  /** Controls validation of Cassandra server hostname. Defaults to true. */\n  public B sslHostnameValidation(boolean sslHostnameValidation) {\n    this.sslHostnameValidation = sslHostnameValidation;\n    return (B) this;\n  }\n\n  /** Keyspace to store span and index data. Defaults to \"zipkin3\" */\n  public B keyspace(String keyspace) {\n    if (keyspace == null) throw new NullPointerException(\"keyspace == null\");\n    this.keyspace = keyspace;\n    return (B) this;\n  }\n\n  /** Override to control how sessions are created. */\n  public B sessionFactory(CassandraStorage.SessionFactory sessionFactory) {\n    if (sessionFactory == null) throw new NullPointerException(\"sessionFactory == null\");\n    this.sessionFactory = sessionFactory;\n    return (B) this;\n  }\n\n  public B ensureSchema(boolean ensureSchema) {\n    if (ensureSchema) {\n      this.ensureSchema = Schema::ensure;\n    } else {\n      this.ensureSchema = Schema::validate;\n    }\n    return (B) this;","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin-storage/cassandra/src/main/java/zipkin2/storage/cassandra/CassandraStorageBuilder.java#L130-L166","documentation":"CassandraStorageBuilder.keyspace(String) throws NullPointerException ('keyspace == null') when the keyspace name is set to null. The keyspace (default 'zipkin3') determines where spans and indexes are stored; a null name cannot map to a Cassandra keyspace, so the builder fails fast instead of erroring later during session creation.","triggerScenarios":"Calling keyspace(null), or passing a null from property resolution where zipkin.storage.cassandra.keyspace / CASSANDRA_KEYSPACE was not configured in a custom embedding (the server's property binding supplies a default, direct builder use does not).","commonSituations":"Embedding the Cassandra storage module programmatically and forgetting the keyspace; env var not set in the container; property renamed during an upgrade leaving the old key unset.","solutions":["Pass a keyspace name, e.g. keyspace(\"zipkin3\")","Default null config values to \"zipkin3\" before calling the builder","Verify the env/property variable name in the deployment matches the version of Zipkin in use"],"exampleFix":"// before\nString ks = System.getenv(\"CASSANDRA_KEYSPACE\"); // null\nbuilder.keyspace(ks);\n\n// after\nString ks = System.getenv(\"CASSANDRA_KEYSPACE\");\nbuilder.keyspace(ks != null ? ks : \"zipkin3\");","handlingStrategy":"validation","validationCode":"String keyspace = System.getenv(\"CASSANDRA_KEYSPACE\");\nbuilder.keyspace(keyspace != null ? keyspace : \"zipkin3\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Default the keyspace name to zipkin3 in one config-resolution helper","Log the resolved keyspace at startup to catch missing env vars early"],"tags":["zipkin","cassandra","keyspace","null-check","configuration"],"backgroundTag":null,"analyzedSha":"878ce2a1fad54ca941d17fdcf2e1d924b148eb1f","analyzedAt":"2026-08-14T15:17:09.895Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}