{"record":{"id":"a9ff2d4fa803215f","repo":"microg/GmsCore","slug":"error-main-thread-a9ff2d","errorCode":"ERROR_MAIN_THREAD","errorMessage":"ERROR_MAIN_THREAD","messagePattern":"ERROR_MAIN_THREAD","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"play-services-iid/src/main/java/com/google/android/gms/iid/InstanceID.java","lineNumber":134,"sourceCode":"    }\n\n    /**\n     * Revokes access to a scope (action) for an entity previously\n     * authorized by {@link com.google.android.gms.iid.InstanceID#getToken(java.lang.String, java.lang.String)}.\n     * <p/>\n     * Do not call this function on the main thread.\n     *\n     * @param authorizedEntity Entity that must no longer have access.\n     * @param scope            Action that entity is no longer authorized to perform.\n     * @throws IOException if the request fails.\n     */\n    public void deleteToken(String authorizedEntity, String scope) throws IOException {\n        deleteToken(authorizedEntity, scope, null);\n    }\n\n    @PublicApi(exclude = true)\n    public void deleteToken(String authorizedEntity, String scope, Bundle extras) throws IOException {\n        if (Looper.getMainLooper() == Looper.myLooper()) throw new IOException(ERROR_MAIN_THREAD);\n\n        storeInstance.delete(subtype, authorizedEntity, scope);\n\n        if (extras == null) extras = new Bundle();\n        extras.putString(EXTRA_SENDER, authorizedEntity);\n        extras.putString(EXTRA_SUBSCIPTION, authorizedEntity);\n        extras.putString(EXTRA_DELETE, \"1\");\n        extras.putString(\"X-\" + EXTRA_DELETE, \"1\");\n        extras.putString(EXTRA_SUBTYPE, TextUtils.isEmpty(subtype) ? authorizedEntity : subtype);\n        extras.putString(\"X-\" + EXTRA_SUBTYPE, TextUtils.isEmpty(subtype) ? authorizedEntity : subtype);\n        if (scope != null) extras.putString(EXTRA_SCOPE, scope);\n\n        rpc.handleRegisterMessageResult(rpc.sendRegisterMessageBlocking(extras, getKeyPair()));\n    }\n\n    /**\n     * Returns time when instance ID was created.\n     *","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-iid/src/main/java/com/google/android/gms/iid/InstanceID.java#L116-L152","documentation":"Threading guard in InstanceID.deleteToken: the token operation was invoked on the main thread, which InstanceID forbids; the error string 'ERROR_MAIN_THREAD' is surfaced in the failure result rather than thrown directly.","triggerScenarios":"Thrown at play-services-iid/src/main/java/com/google/android/gms/iid/InstanceID.java:134 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call deleteToken/getToken from a background thread or coroutine","Retry once the operation runs off the main thread"],"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-14T05:17:10.506Z"}