{"record":{"id":"0de177dd9dfdcae2","repo":"testcontainers/testcontainers-java","slug":"version-is-not-a-semantic-version-localstack-will-run-in","errorCode":null,"errorMessage":"Version {} is not a semantic version, LocalStack will run in legacy mode.","messagePattern":"Version (.+?) is not a semantic version, LocalStack will run in legacy mode\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/localstack/src/main/java/org/testcontainers/containers/localstack/LocalStackContainer.java","lineNumber":175,"sourceCode":"        log.warn(\"Version {} is not a semantic version, services list is required.\", version);\n\n        return true;\n    }\n\n    static boolean shouldRunInLegacyMode(String version) {\n        // assume that the latest images are up-to-date\n        // also consider images with extra packages (like latest-bigdata) and service-specific images (like s3-latest)\n        if (version.equals(\"latest\") || version.startsWith(\"latest-\") || version.endsWith(\"-latest\")) {\n            return false;\n        }\n\n        ComparableVersion comparableVersion = new ComparableVersion(version);\n        if (comparableVersion.isSemanticVersion()) {\n            boolean versionRequiresLegacyMode = comparableVersion.isLessThan(\"0.11\");\n            return versionRequiresLegacyMode;\n        }\n\n        log.warn(\"Version {} is not a semantic version, LocalStack will run in legacy mode.\", version);\n        log.warn(\n            \"Consider using \\\"LocalStackContainer(DockerImageName dockerImageName, boolean legacyMode)\\\" constructor if you want to disable legacy mode.\"\n        );\n        return true;\n    }\n\n    @Override\n    protected void configure() {\n        super.configure();\n\n        if (this.servicesEnvVarRequired) {\n            Preconditions.check(\"services list must not be empty\", !services.isEmpty());\n        }\n\n        if (!services.isEmpty()) {\n            withEnv(\"SERVICES\", services.stream().map(EnabledService::getName).collect(Collectors.joining(\",\")));\n            if (this.servicesEnvVarRequired) {\n                withEnv(\"EAGER_SERVICE_LOADING\", \"1\");","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/localstack/src/main/java/org/testcontainers/containers/localstack/LocalStackContainer.java#L157-L193","documentation":"shouldRunInLegacyMode compares the LocalStack image version to 0.11 to decide between the legacy single-container setup and the modern one. When the version tag is not a semantic version, the method logs this warning (plus the follow-up constructor hint) and returns true, forcing legacy mode. Users with non-standard image tags get legacy behavior they may not expect.","triggerScenarios":"Creating LocalStackContainer with an image tag that cannot be parsed as a semantic version (e.g. :latest, :nightly, custom tags); the static shouldRunInLegacyMode(version) check falls into the non-semantic branch.","commonSituations":"CI caching 'latest' of localstack; local builds tagged 'local'; older testcontainers code paths that accepted arbitrary image names.","solutions":["Pin a semantic version tag such as localstack/localstack:2.3.0","Use the explicit constructor new LocalStackContainer(image, false) to opt out of legacy mode regardless of tag parsing","Set up withServices() explicitly so the container config is intentional"],"exampleFix":"// before\nnew LocalStackContainer(DockerImageName.parse(\"localstack/localstack:nightly\"))\n// after\nnew LocalStackContainer(DockerImageName.parse(\"localstack/localstack:2.3.0\"), false)","handlingStrategy":"validation","validationCode":"String tag = imageName.getVersionPart();\nif (!tag.matches(\"\\\\d+(\\\\.\\\\d+)*\")) {\n    // choose mode explicitly rather than letting the fallback decide\n}\nnew LocalStackContainer(imageName, /*legacyMode*/ false);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the (DockerImageName, boolean legacyMode) constructor when tags are not semver","Pin localstack to semver tags in CI","Assert expected container config (env vars) in an integration smoke test"],"tags":["localstack","versioning","legacy-mode","testcontainers"],"backgroundTag":"invalid-config-value","analyzedSha":"8e549514e3f01c57d70546fbb8599d138f3903e5","analyzedAt":"2026-09-12T14:56:41.227Z","contentChangedAt":"2026-09-12T14:56:41.227Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}