{"record":{"id":"b4d6d342cf0d1558","repo":"microg/GmsCore","slug":"failed-to-call-dynamite-module","errorCode":null,"errorMessage":"Failed to call dynamite module","messagePattern":"Failed to call dynamite module","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"play-services-cast-framework/src/main/java/com/google/android/gms/cast/framework/CastContext.java","lineNumber":150,"sourceCode":"    private IMediaRouter mediaRouter;\n    private List<SessionProvider> additionalSessionProviders;\n    private CastSessionProvider castSessionProvider;\n    private ICastContext delegate;\n    private SessionManager sessionManager;\n    private DiscoveryManager discoveryManager;\n\n    private CastContext(Context appContext, CastOptions castOptions, @Nullable List<SessionProvider> additionalSessionProviders) throws ModuleUnavailableException {\n        this.appContext = appContext;\n        this.castOptions = castOptions;\n        this.mediaRouter = null; // TODO\n        this.additionalSessionProviders = additionalSessionProviders;\n        this.castSessionProvider = new CastSessionProvider(appContext, castOptions);\n        try {\n            this.delegate = CastDynamiteModule.newCastContext(appContext, castOptions, mediaRouter, getSessionProviderMap());\n            this.sessionManager = new SessionManager(appContext, delegate.getSessionManagerImpl());\n            this.discoveryManager = new DiscoveryManager(appContext, delegate.getDiscoveryManagerImpl());\n        } catch (RemoteException e) {\n            throw new IllegalStateException(\"Failed to call dynamite module\", e);\n        }\n    }\n\n    private Map<String, IBinder> getSessionProviderMap() {\n        Map<String, IBinder> map = new HashMap<>();\n        if (castSessionProvider != null) {\n            map.put(castSessionProvider.getCategory(), castSessionProvider.asBinder());\n        }\n        List<SessionProvider> list = this.additionalSessionProviders;\n        if (list != null) {\n            for (SessionProvider sessionProvider : list) {\n                if (sessionProvider == null) throw new IllegalArgumentException(\"Additional SessionProvider must not be null.\");\n                if (sessionProvider.getCategory() == null || sessionProvider.getCategory().isEmpty())\n                    throw new IllegalArgumentException(\"Category for SessionProvider must not be null or empty string.\");\n                if (map.containsKey(sessionProvider.getCategory()))\n                    throw new IllegalArgumentException(\"SessionProvider for category \" + sessionProvider.getCategory() + \" already added\");\n                map.put(sessionProvider.getCategory(), sessionProvider.asBinder());\n            }","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-cast-framework/src/main/java/com/google/android/gms/cast/framework/CastContext.java#L132-L168","documentation":"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.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}