{"record":{"id":"40091f35de0ccc94","repo":"testcontainers/testcontainers-java","slug":"version-is-not-a-semantic-version-services-list-is-required","errorCode":null,"errorMessage":"Version {} is not a semantic version, services list is required.","messagePattern":"Version (.+?) is not a semantic version, services list is required\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"modules/localstack/src/main/java/org/testcontainers/containers/localstack/LocalStackContainer.java","lineNumber":157,"sourceCode":"        if (version.equals(\"latest\")) {\n            return true;\n        }\n\n        ComparableVersion comparableVersion = new ComparableVersion(version);\n        return comparableVersion.isGreaterThanOrEqualTo(\"2.0.0\");\n    }\n\n    private static boolean isServicesEnvVarRequired(String version) {\n        if (version.equals(\"latest\")) {\n            return false;\n        }\n\n        ComparableVersion comparableVersion = new ComparableVersion(version);\n        if (comparableVersion.isSemanticVersion()) {\n            return comparableVersion.isLessThan(\"0.13\");\n        }\n\n        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);","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/testcontainers/testcontainers-java/blob/8e549514e3f01c57d70546fbb8599d138f3903e5/modules/localstack/src/main/java/org/testcontainers/containers/localstack/LocalStackContainer.java#L139-L175","documentation":"LocalStackContainer decides whether the SERVICES environment variable must be set by comparing the image version to 0.13. If the version string extracted from the image is not a parsable semantic version, isServicesEnvVarRequired logs this warning and conservatively returns true, requiring a services list. This is a defensive fallback for custom or oddly tagged LocalStack images.","triggerScenarios":"Constructing LocalStackContainer with a DockerImageName whose version tag is not semantic (e.g. localstack/localstack:latest, custom dates like :2021-03-12, or sha/digest-style tags); static check isServicesEnvVarRequired(version) then hits the non-semantic branch.","commonSituations":"Pinning localstack/localstack:latest in tests; using a locally built image tagged 'dev' or 'snapshot'; upgrading from an old pattern where arbitrary tags were common.","solutions":["Use a semver-tagged image, e.g. DockerImageName.parse(\"localstack/localstack:3.4.0\")","Always call withServices(LocalStack.Service.S3, ...) so the SERVICES env var is set regardless of the fallback","If using a custom tag, retag or build your image with a semantic version tag"],"exampleFix":"// before\nLocalStackContainer ls = new LocalStackContainer(DockerImageName.parse(\"localstack/localstack:latest\"));\n// after\nLocalStackContainer ls = new LocalStackContainer(DockerImageName.parse(\"localstack/localstack:3.4.0\"))\n    .withServices(LocalStack.Service.S3, LocalStack.Service.SQS);","handlingStrategy":"validation","validationCode":"String tag = imageName.getVersionPart();\nif (!tag.matches(\"\\\\d+(\\\\.\\\\d+)*\")) {\n    throw new IllegalArgumentException(\"Use a semantic version tag for localstack, got: \" + tag);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin localstack images to semantic version tags, never 'latest'","Always configure withServices(...) explicitly","Review startup logs for non-semantic-version warnings after image upgrades"],"tags":["localstack","versioning","docker-image","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"}