{"record":{"id":"cce36e7d91b5f826","repo":"quarkusio/quarkus","slug":"only-instances-of-smallryecontextmanager-are-suppo","errorCode":null,"errorMessage":"Only instances of SmallRyeContextManager are supported: ","messagePattern":"Only instances of SmallRyeContextManager are supported: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/QuarkusContextManagerProvider.java","lineNumber":33,"sourceCode":"    @Override\n    public SmallRyeContextManager getContextManager(ClassLoader classLoader) {\n        return contextManager;\n    }\n\n    @Override\n    public SmallRyeContextManager getContextManager() {\n        return contextManager;\n    }\n\n    @Override\n    public ContextManager findContextManager(ClassLoader classLoader) {\n        return contextManager;\n    }\n\n    @Override\n    public void registerContextManager(ContextManager manager, ClassLoader classLoader) {\n        if (manager instanceof SmallRyeContextManager == false) {\n            throw new IllegalArgumentException(\"Only instances of SmallRyeContextManager are supported: \" + manager);\n        }\n        contextManager = (SmallRyeContextManager) manager;\n    }\n\n    @Override\n    public void releaseContextManager(ContextManager manager) {\n        contextManager = null;\n    }\n}\n","sourceCodeStart":15,"sourceCodeEnd":43,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/QuarkusContextManagerProvider.java#L15-L43","documentation":"QuarkusContextManagerProvider only accepts SmallRyeContextManager instances; the MicroProfile ContextProvider SPI allows registering arbitrary ContextManager implementations, but Quarkus's provider implementation must keep a reference to the concrete SmallRye type, so anything else is rejected with an IllegalArgumentException.","triggerScenarios":"Calling ContextManagerProvider.registerContextManager(manager, classLoader) (or triggering it via an extension/library that does) with a custom or mock ContextManager that is not a SmallRyeContextManager.","commonSituations":"Integrating a third-party context library that installs its own ContextManager; tests registering a mocked ContextManager; duplicate provider registration ordering where a foreign implementation wins.","solutions":["Do not register a custom ContextManager on Quarkus — use the built-in one provided by the extension","Wrap your functionality in a ThreadContextProvider instead of a full ContextManager","Ensure no dependency (e.g. another MP Context Propagation implementation) is calling registerContextManager with a foreign manager; exclude or reconfigure it"],"exampleFix":"// before\nContextManagerProvider.provider().registerContextManager(myCustomManager, cl);\n// after\n// do nothing — Quarkus manages its own SmallRyeContextManager\n// or contribute a ThreadContextProvider via META-INF/services","handlingStrategy":"type-guard","validationCode":"if (manager instanceof SmallRyeContextManager) {\n    ContextManagerProvider.provider().registerContextManager(manager, cl);\n}","typeGuard":"boolean isSmallRye(ContextManager m) { return m instanceof SmallRyeContextManager; }","tryCatchPattern":"try { provider.registerContextManager(manager, cl); }\ncatch (IllegalArgumentException e) { log.error(\"Quarkus only accepts SmallRyeContextManager\", e); }","preventionTips":["Do not install custom ContextManagers on Quarkus; use the built-in one","Contribute ThreadContextProviders instead of full ContextManagers","Check dependencies for libraries that auto-register their own ContextManager"],"tags":["context-propagation","type-mismatch","integration"],"backgroundTag":"incompatible-implementation-type","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}