quarkusio/quarkus · error · RuntimeException
Trying to invoke ContextPropagation on a partially-configure
Error message
Trying to invoke ContextPropagation on a partially-configured ContextManager instance. You should wait until runtime init is done. You can do that by consuming the ContextPropagationBuildItem.
What it means
Before runtime init completes, the context propagation extension substitutes a placeholder executor whose every method calls nope(), which throws a RuntimeException telling you the ContextManager is only partially configured and to wait for runtime init — e.g. by consuming the ContextPropagationBuildItem in a build step.
Source
Thrown at extensions/smallrye-context-propagation/runtime/src/main/java/io/quarkus/smallrye/context/runtime/SmallRyeContextPropagationRecorder.java:115
return null;
}
@Override
public <T> T invokeAny(Collection<? extends Callable<T>> tasks)
throws InterruptedException, ExecutionException {
nope();
return null;
}
@Override
public <T> T invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
throws InterruptedException, ExecutionException, TimeoutException {
nope();
return null;
}
private void nope() {
throw new RuntimeException(
"Trying to invoke ContextPropagation on a partially-configured ContextManager instance. You should wait until runtime init is done. You can do that by consuming the ContextPropagationBuildItem.");
}
};
private static SmallRyeContextManager.Builder builder;
public void configureStaticInit(List<ThreadContextProvider> discoveredProviders,
List<ContextManagerExtension> discoveredExtensions) {
// build the manager at static init time
// in the live-reload mode, the provider instance may be already set in the previous start
if (ContextManagerProvider.INSTANCE.get() == null) {
ContextManagerProvider contextManagerProvider = new QuarkusContextManagerProvider();
ContextManagerProvider.register(contextManagerProvider);
}
// do what config we can here, but we need the runtime executor service to finish
builder = (SmallRyeContextManager.Builder) ContextManagerProvider.instance()
.getContextManagerBuilder();
builder.withThreadContextProviders(discoveredProviders.toArray(new ThreadContextProvider[0]));View on GitHub (pinned to e1c734241f)
Solutions
- Defer executor usage until after runtime init (RuntimeInit shutdown/startup hooks, @Startup bean ordering, or observation of Started event)
- In build-time code, consume the ContextPropagationBuildItem instead of touching the executor directly
- Remove usage of the managed executor from static-init paths; use a plain executor there
Example fix
// before
// static init:
contextExecutor.execute(task);
// after
public void onStart(@Observes StartupEvent ev) {
contextExecutor.execute(task);
} Defensive patterns
Strategy: try-catch
Validate before calling
if (isStaticInit() || !runtimeInitialized) {
throw new IllegalStateException("Executor not usable before runtime init");
} Try / catch
try { executor.execute(task); }
catch (RuntimeException e) {
if (e.getMessage().contains("partially-configured ContextManager")) {
// defer to StartupEvent / ContextPropagationBuildItem
}
} Prevention
- Never touch the managed executor in static init or before runtime init
- Consume ContextPropagationBuildItem in build steps instead of calling the executor
- Observe StartupEvent (or StartedEvent) before scheduling work
- Use a plain executor for build-time/static-init work
When it happens
Trigger: Calling execute/shutdown/shutdownNow/isShutdown/isTerminated/awaitTermination on the context-propagation-managed executor during static init or before runtime startup — e.g. running executor tasks from a @StaticInit-safe bean, build-time code, or early singleton init.
Common situations: Application logic touching the managed executor from a static initializer or startup bean initialized before runtime init; build steps invoking the executor directly instead of consuming ContextPropagationBuildItem.
Related errors
- This executor is managed by the container and cannot be shut
- Quarkus manual bootstrap failed
- shutdown not allowed on managed executor service
- shutdownNow not allowed on managed executor service
- Can only sync state on the server side of remote dev mode
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/f477efdffe2ee776.
Report an issue: GitHub.