{"record":{"id":"4b1840da24e51688","repo":"testcontainers/testcontainers-java","slug":"alternator-is-not-enabled","errorCode":null,"errorMessage":"Alternator is not enabled","messagePattern":"Alternator is not enabled","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"modules/scylladb/src/main/java/org/testcontainers/scylladb/ScyllaDBContainer.java","lineNumber":105,"sourceCode":"        return this;\n    }\n\n    /**\n     * Retrieve an {@link InetSocketAddress} for connecting to the ScyllaDB container via the driver.\n     *\n     * @return A InetSocketAddress representation of this ScyllaDB container's host and port.\n     */\n    public InetSocketAddress getContactPoint() {\n        return new InetSocketAddress(getHost(), getMappedPort(CQL_PORT));\n    }\n\n    public InetSocketAddress getShardAwareContactPoint() {\n        return new InetSocketAddress(getHost(), getMappedPort(SHARD_AWARE_PORT));\n    }\n\n    public String getAlternatorEndpoint() {\n        if (!this.alternatorEnabled) {\n            throw new IllegalStateException(\"Alternator is not enabled\");\n        }\n        return \"http://\" + getHost() + \":\" + getMappedPort(ALTERNATOR_PORT);\n    }\n}\n","sourceCodeStart":87,"sourceCodeEnd":110,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/scylladb/src/main/java/org/testcontainers/scylladb/ScyllaDBContainer.java#L87-L110","documentation":"ScyllaDBContainer.getAlternatorEndpoint returns the HTTP endpoint of ScyllaDB's Alternator (DynamoDB-compatible) API, but only if Alternator mode was enabled on the container. If the container was started without enabling Alternator, the endpoint does not exist and the method throws IllegalStateException.","triggerScenarios":"Calling container.getAlternatorEndpoint() on a ScyllaDBContainer created without withAlternatorEnabled() (or equivalent config) before/without starting it in Alternator mode.","commonSituations":"Tests that copy ScyllaDB examples using the Alternator API but forget the enable call; enabling Alternator only in some test profiles; using a shared container config where Alternator was removed.","solutions":["Enable Alternator before starting: call container.withAlternatorEnabled() (or the constructor/config option) prior to container.start().","Guard calls with an isEnabled/flag check or only call getAlternatorEndpoint in tests that configure Alternator.","If Alternator is not needed, use the CQL API (getContactPoint/getShardAwareContactPoint) instead.","Verify the image supports Alternator and that no create-cmd modifiers strip the alternator flag."],"exampleFix":"// before\nScyllaDBContainer container = new ScyllaDBContainer(\"scylladb/scylla\");\ncontainer.start();\nString endpoint = container.getAlternatorEndpoint(); // throws\n// after\nScyllaDBContainer container = new ScyllaDBContainer(\"scylladb/scylla\")\n    .withAlternatorEnabled();\ncontainer.start();\nString endpoint = container.getAlternatorEndpoint();","handlingStrategy":"validation","validationCode":"if (!alternatorEnabled) {\n  throw new IllegalStateException(\"Call withAlternatorEnabled() before start() to use getAlternatorEndpoint()\");\n}\nInetSocketAddress alternator = container.getAlternatorEndpoint();","typeGuard":null,"tryCatchPattern":"try {\n  String endpoint = container.getAlternatorEndpoint();\n} catch (IllegalStateException e) {\n  if (e.getMessage().contains(\"Alternator is not enabled\")) {\n    throw new IllegalStateException(\"Enable Alternator with withAlternatorEnabled() before start()\"); }\n  throw e;\n}","preventionTips":["Always call withAlternatorEnabled() in the shared container factory if any test uses Alternator","Keep container configuration in one bootstrap class so enable-flags are not lost","Use CQL contact points when Alternator is not required"],"tags":["scylladb","alternator","illegal-state","feature-not-enabled"],"backgroundTag":"feature-not-enabled","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}