{"record":{"id":"721b7d19dfbf0dc0","repo":"apache/dubbo","slug":"unsupported-environment-s-only-support-s-s-s","errorCode":null,"errorMessage":"Unsupported environment: %s, only support %s/%s/%s, default is %s.","messagePattern":"Unsupported environment: (.+?), only support (.+?)/(.+?)/(.+?), default is (.+?)\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"dubbo-common/src/main/java/org/apache/dubbo/config/ApplicationConfig.java","lineNumber":408,"sourceCode":"    public String getArchitecture() {\n        return architecture;\n    }\n\n    public void setArchitecture(String architecture) {\n        this.architecture = architecture;\n    }\n\n    public String getEnvironment() {\n        return environment;\n    }\n\n    public void setEnvironment(String environment) {\n        if (environment != null\n                && !(DEVELOPMENT_ENVIRONMENT.equals(environment)\n                        || TEST_ENVIRONMENT.equals(environment)\n                        || PRODUCTION_ENVIRONMENT.equals(environment))) {\n\n            throw new IllegalStateException(String.format(\n                    \"Unsupported environment: %s, only support %s/%s/%s, default is %s.\",\n                    environment,\n                    DEVELOPMENT_ENVIRONMENT,\n                    TEST_ENVIRONMENT,\n                    PRODUCTION_ENVIRONMENT,\n                    PRODUCTION_ENVIRONMENT));\n        }\n        this.environment = environment;\n    }\n\n    public RegistryConfig getRegistry() {\n        return CollectionUtils.isEmpty(registries) ? null : registries.get(0);\n    }\n\n    public void setRegistry(RegistryConfig registry) {\n        List<RegistryConfig> registries = new ArrayList<>(1);\n        registries.add(registry);\n        this.registries = registries;","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/apache/dubbo/blob/3a3043227f5571d25eb2889de5bca22f2914843b/dubbo-common/src/main/java/org/apache/dubbo/config/ApplicationConfig.java#L390-L426","documentation":"Thrown by ApplicationConfig.setEnvironment() when the environment string is not one of the three allowed values (development, test, production, as defined by DEVELOPMENT_ENVIRONMENT/TEST_ENVIRONMENT/PRODUCTION_ENVIRONMENT constants). The environment tag influences Dubbo's behavior such as the serializer/deserializer Kryo2 output and other env-aware defaults.","triggerScenarios":"Setting dubbo.application.environment or ApplicationConfig.setEnvironment() to a value outside {development, test, production}, e.g. 'staging', 'qa', 'prod'.","commonSituations":"Teams using 'staging' or 'prod' as environment names and assuming Dubbo accepts them. Copying Spring profile names directly into the Dubbo environment property.","solutions":["Use one of: 'development', 'test', 'production' (exact match).","Map your custom environment name to the closest supported value before setting it.","Omit the property entirely if you don't need environment-specific Dubbo behavior (production is the documented default)."],"exampleFix":"// before\n<dubbo:application name=\"app\" environment=\"prod\"/>\n// after\n<dubbo:application name=\"app\" environment=\"production\"/>","handlingStrategy":"validation","validationCode":"import java.util.Set;\nSet<String> valid = Set.of(\"development\", \"test\", \"production\");\nString env = \"production\";\nif (env != null && !valid.contains(env)) {\n    throw new IllegalArgumentException(\"Invalid environment: \" + env + \". Allowed: \" + valid);\n}\napplicationConfig.setEnvironment(env);","typeGuard":"static boolean isValidEnvironment(String env) {\n    return env == null || Set.of(\"development\", \"test\", \"production\").contains(env);\n}","tryCatchPattern":"try {\n    applicationConfig.setEnvironment(env);\n} catch (IllegalStateException e) {\n    if (e.getMessage().startsWith(\"Unsupported environment\")) {\n        applicationConfig.setEnvironment(\"production\"); // safe default\n    } else throw e;\n}","preventionTips":["Map environment names (staging/prod) to the three allowed values.","Do not reuse Spring profile names directly as Dubbo environment.","Omit the property when env-specific Dubbo behavior is unneeded."],"tags":["config","application","environment","validation"],"backgroundTag":null,"analyzedSha":"3a3043227f5571d25eb2889de5bca22f2914843b","analyzedAt":"2026-08-14T00:43:19.853Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}