microg/GmsCore · error · IllegalStateException
Failed to call dynamite module
Error message
Failed to call dynamite module
What it means
Thrown in the CastContext constructor when a RemoteException occurs while creating the remote cast context (or fetching SessionManager/DiscoveryManager impls) through the Cast Dynamite module. The RemoteException is chained; binder-level communication with the module failed during initialization.
Source
Thrown at play-services-cast-framework/src/main/java/com/google/android/gms/cast/framework/CastContext.java:150
private IMediaRouter mediaRouter;
private List<SessionProvider> additionalSessionProviders;
private CastSessionProvider castSessionProvider;
private ICastContext delegate;
private SessionManager sessionManager;
private DiscoveryManager discoveryManager;
private CastContext(Context appContext, CastOptions castOptions, @Nullable List<SessionProvider> additionalSessionProviders) throws ModuleUnavailableException {
this.appContext = appContext;
this.castOptions = castOptions;
this.mediaRouter = null; // TODO
this.additionalSessionProviders = additionalSessionProviders;
this.castSessionProvider = new CastSessionProvider(appContext, castOptions);
try {
this.delegate = CastDynamiteModule.newCastContext(appContext, castOptions, mediaRouter, getSessionProviderMap());
this.sessionManager = new SessionManager(appContext, delegate.getSessionManagerImpl());
this.discoveryManager = new DiscoveryManager(appContext, delegate.getDiscoveryManagerImpl());
} catch (RemoteException e) {
throw new IllegalStateException("Failed to call dynamite module", e);
}
}
private Map<String, IBinder> getSessionProviderMap() {
Map<String, IBinder> map = new HashMap<>();
if (castSessionProvider != null) {
map.put(castSessionProvider.getCategory(), castSessionProvider.asBinder());
}
List<SessionProvider> list = this.additionalSessionProviders;
if (list != null) {
for (SessionProvider sessionProvider : list) {
if (sessionProvider == null) throw new IllegalArgumentException("Additional SessionProvider must not be null.");
if (sessionProvider.getCategory() == null || sessionProvider.getCategory().isEmpty())
throw new IllegalArgumentException("Category for SessionProvider must not be null or empty string.");
if (map.containsKey(sessionProvider.getCategory()))
throw new IllegalArgumentException("SessionProvider for category " + sessionProvider.getCategory() + " already added");
map.put(sessionProvider.getCategory(), sessionProvider.asBinder());
}View on GitHub (pinned to 157c9d86ac)
Solutions
- Catch the IllegalStateException/ModuleUnavailableException and retry CastContext creation
- Ensure the Cast Dynamite module and Play services (or microG) are available and current
- Fall back to running without cast functionality
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at play-services-cast-framework/src/main/java/com/google/android/gms/cast/framework/CastContext.java:150 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06).
Data as JSON: /api/errors/b4d6d342cf0d1558.
Report an issue: GitHub.