{"record":{"id":"1099637a41ca522a","repo":"apache/cassandra","slug":"beta-version-of-server-used-s-but-use-beta-fla","errorCode":null,"errorMessage":"Beta version of server used (%s), but USE_BETA flag is not set","messagePattern":"Beta version of server used \\((.+?)\\), but USE_BETA flag is not set","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/transport/SimpleClient.java","lineNumber":168,"sourceCode":"            return this;\n        }\n\n        public Builder protocolVersion(ProtocolVersion version)\n        {\n            this.version = version;\n            return this;\n        }\n\n        public Builder largeMessageThreshold(int bytes)\n        {\n            largeMessageThreshold = bytes;\n            return this;\n        }\n\n        public SimpleClient build()\n        {\n            if (version.isBeta() && !useBeta)\n                throw new IllegalArgumentException(String.format(\"Beta version of server used (%s), but USE_BETA flag is not set\", version));\n            return new SimpleClient(this);\n        }\n    }\n\n    public static Builder builder(String host, int port)\n    {\n        return new Builder(host, port);\n    }\n\n    private SimpleClient(Builder builder)\n    {\n        this.host = builder.host;\n        this.port = builder.port;\n        this.version = builder.version;\n        this.encryptionOptions = builder.encryptionOptions.applyConfig();\n        this.largeMessageThreshold = builder.largeMessageThreshold;\n    }\n","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/transport/SimpleClient.java#L150-L186","documentation":"Thrown by SimpleClient.Builder.build() when the caller requests a beta protocol version without setting the USE_BETA startup flag. The CQL binary protocol requires clients to explicitly opt in (USE_BETA flag in STARTUP) when speaking a beta protocol version; this client-side guard fails fast with an IllegalArgumentException before any connection is made.","triggerScenarios":"Builder configured with a beta ProtocolVersion (e.g. the latest in-development version) but useBeta left false; build() checks version.isBeta() && !useBeta and throws.","commonSituations":"Testing against a dev/bleeding-edge server with a beta protocol, copying test-client code that pins a version that has since become beta, or forgetting the flag when explicitly bumping the client's protocol version.","solutions":["Set useBeta(true) on the SimpleClient.Builder when using a beta protocol version","Or pin the client to the latest non-beta ProtocolVersion","Upgrade to a server build where the version you need is no longer beta, then drop the flag","Only enable beta in test environments — it is not meant for production clients"],"exampleFix":"// before\nSimpleClient.builder(host, port).version(ProtocolVersion.V5).build();\n// after (V5 beta era)\nSimpleClient.builder(host, port).version(ProtocolVersion.V5).useBeta(true).build();","handlingStrategy":"validation","validationCode":"if (version.isBeta() && !useBeta)\n    throw new IllegalArgumentException(\"set useBeta(true) on the builder or use a non-beta ProtocolVersion\");","typeGuard":"boolean safeClientVersion(ProtocolVersion v) { return !v.isBeta(); }","tryCatchPattern":"try { client = builder.build(); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"USE_BETA\")) builder.useBeta(true).build(); else throw e; }","preventionTips":["Only target beta protocol versions deliberately in test code","Prefer builder() so the flag is set in one audited place","Re-check pinned versions after server upgrades (beta flags can shift)","Keep production clients on stable protocol versions"],"tags":["cql-protocol","beta-version","client","builder"],"backgroundTag":"missing-required-flag","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}