{"record":{"id":"96e2b68e5048c332","repo":"quarkusio/quarkus","slug":"not-possible-to-define-the-scope-s-for-the-rest-c","errorCode":null,"errorMessage":"Not possible to define the scope %s for the REST client %s ","messagePattern":"Not possible to define the scope (.+?) for the REST client (.+?) ","errorType":"exception","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"extensions/resteasy-classic/rest-client-config/deployment/src/main/java/io/quarkus/restclient/config/deployment/RestClientsBuildTimeConfigBuildItem.java","lineNumber":151,"sourceCode":"            } else {\n                return scope;\n            }\n        }\n        return Optional.empty();\n    }\n\n    private static Optional<BuiltinScope> builtinScopeFromName(DotName scopeName, String restClientClass) {\n        BuiltinScope scope = BuiltinScope.from(scopeName);\n        if (scope != null) {\n            return Optional.of(scope);\n        }\n\n        for (BuiltinScope builtinScope : BuiltinScope.values()) {\n            if (builtinScope.getName().withoutPackagePrefix().equalsIgnoreCase(scopeName.toString())) {\n                return Optional.of(builtinScope);\n            }\n        }\n        throw new ConfigurationException(\n                String.format(\"Not possible to define the scope %s for the REST client %s \", scopeName, restClientClass));\n    }\n}\n","sourceCodeStart":133,"sourceCodeEnd":155,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/resteasy-classic/rest-client-config/deployment/src/main/java/io/quarkus/restclient/config/deployment/RestClientsBuildTimeConfigBuildItem.java#L133-L155","documentation":"During REST client build-time configuration processing, Quarkus maps the scope name given via @RegisterRestClient(configKey=...) / rest-client config 'scope' property to a known CDI BuiltinScope. If the configured scope name does not match any builtin scope (case-insensitively), the build fails with a ConfigurationException naming the scope and the REST client class.","triggerScenarios":"Setting quarkus.rest-client.<key>.scope (or @RegisterRestClient scope attribute) to a value that is not one of: jakarta.enterprise.context.ApplicationScoped, RequestScoped, Dependent, Singleton — e.g. typos like 'appscoped', '@Singleton' with the '@' prefix, or a custom scope not registered in the app.","commonSituations":"Copy-pasting a scope annotation name including '@'; using a custom @Scope without it being discoverable at build time; upgrading Quarkus where javax->jakarta prefix changed the expected canonical name; confusing 'singleton' with 'jakarta.inject.Singleton' (matching is on the simple name of builtin scopes).","solutions":["Set scope to a builtin simple name without '@': ApplicationScoped, RequestScoped, Dependent, or Singleton (case-insensitive)","Remove the '@' prefix and package prefix from the configured value","If a custom scope is required, register it properly and check whether Quarkus supports it for REST clients, otherwise wrap the client in a producer bean with the custom scope","Verify the exact configured key in application.properties matches the client's configKey"],"exampleFix":"// before\nquarkus.rest-client.my-client.scope=@ApplicationScoped\n// after\nquarkus.rest-client.my-client.scope=ApplicationScoped","handlingStrategy":"validation","validationCode":"static final Set<String> BUILTIN = Set.of(\"applicationscoped\",\"requestscoped\",\"dependent\",\"singleton\");\nif (!BUILTIN.contains(scope.toLowerCase().replace(\"@\", \"\")))\n    throw new IllegalStateException(\"Unsupported REST client scope: \" + scope);","typeGuard":null,"tryCatchPattern":"// Build-time failure: fix configuration, cannot be caught at runtime.\n// Catch org.eclipse.microprofile.config.ConfigException / ConfigurationException during startup to fail with a clearer message.","preventionTips":["Configure scope without '@' and without package prefix","Use only ApplicationScoped, RequestScoped, Dependent, or Singleton","Recheck scope values after javax->jakarta migrations","Grep application.properties for quarkus.rest-client.*.scope values when the build fails"],"tags":["quarkus","rest-client","cdi","scope","build-time"],"backgroundTag":"invalid-scope-name","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}