quarkusio/quarkus · error · IllegalArgumentException
Only instances of SmallRyeContextManager are supported:
Error message
Only instances of SmallRyeContextManager are supported:
What it means
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.
Source
Thrown at extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/QuarkusContextManagerProvider.java:33
@Override
public SmallRyeContextManager getContextManager(ClassLoader classLoader) {
return contextManager;
}
@Override
public SmallRyeContextManager getContextManager() {
return contextManager;
}
@Override
public ContextManager findContextManager(ClassLoader classLoader) {
return contextManager;
}
@Override
public void registerContextManager(ContextManager manager, ClassLoader classLoader) {
if (manager instanceof SmallRyeContextManager == false) {
throw new IllegalArgumentException("Only instances of SmallRyeContextManager are supported: " + manager);
}
contextManager = (SmallRyeContextManager) manager;
}
@Override
public void releaseContextManager(ContextManager manager) {
contextManager = null;
}
}
View on GitHub (pinned to e1c734241f)
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
Example fix
// before ContextManagerProvider.provider().registerContextManager(myCustomManager, cl); // after // do nothing — Quarkus manages its own SmallRyeContextManager // or contribute a ThreadContextProvider via META-INF/services
Defensive patterns
Strategy: type-guard
Validate before calling
if (manager instanceof SmallRyeContextManager) {
ContextManagerProvider.provider().registerContextManager(manager, cl);
} Type guard
boolean isSmallRye(ContextManager m) { return m instanceof SmallRyeContextManager; } Try / catch
try { provider.registerContextManager(manager, cl); }
catch (IllegalArgumentException e) { log.error("Quarkus only accepts SmallRyeContextManager", e); } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Offending class is '${className}'
- Cannot serialise field '${i.getName()}' on object '${param}'
- Unknown ExtensionDependency type: ${dependency.getClass().ge
- Top command must implement org.aesh.command.Command interfac
- The provided <settingName> setting value [<settingValue>] is
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/cce36e7d91b5f826.
Report an issue: GitHub.