{"record":{"id":"8f49012563505c74","repo":"microg/GmsCore","slug":"server-specified-exception","errorCode":null,"errorMessage":"Server-specified exception","messagePattern":"Server-specified exception","errorType":"error_code","errorClass":"StandardIntegrityException","httpStatus":null,"severity":"error","filePath":"vending-app/src/main/kotlin/com/google/android/finsky/expressintegrityservice/ExpressIntegrityService.kt","lineNumber":213,"sourceCode":"                    if (expressIntegritySession.webViewRequestMode != 0) {\n                        requestMode(RequestMode.Builder().mode(expressIntegritySession.webViewRequestMode.takeIf { it in 0..2 } ?: 0).build())\n                    }\n                }.build()\n\n                Log.d(TAG, \"intermediateIntegrityRequest: $intermediateIntegrityRequest\")\n\n                val intermediateIntegrityResponse = requestIntermediateIntegrity(context, authToken, intermediateIntegrityRequest).intermediateIntegrityResponseWrapper?.intermediateIntegrityResponse\n                    ?: IntermediateIntegrityResponse()\n\n                Log.d(TAG, \"requestIntermediateIntegrity response: ${intermediateIntegrityResponse.encode().encodeBase64(true)}\")\n\n                val errorCode = intermediateIntegrityResponse.errorInfo?.let { error ->\n                    if (error.errorCode == null) {\n                        null\n                    } else if (error.testErrorType == TestErrorType.REQUEST_EXPRESS) {\n                        error.errorCode\n                    } else if (error.testErrorType == TestErrorType.WARMUP) {\n                        throw StandardIntegrityException(error.errorCode, \"Server-specified exception\")\n                    } else null\n                }\n\n                val defaultAccountName: String = runCatching {\n                    if (expressIntegritySession.webViewRequestMode != 0) {\n                        RESULT_UN_AUTH\n                    } else {\n                        AccountManager.get(context).getAccountsByType(DEFAULT_ACCOUNT_TYPE).firstOrNull()?.name ?: RESULT_UN_AUTH\n                    }\n                }.getOrDefault(RESULT_UN_AUTH)\n\n                val callerKeyMd5 = clientKey.encode().md5() ?: throw StandardIntegrityException(\"Null callerKeyMd5\")\n                val refreshClientKey = clientKey.newBuilder()\n                    .generated(makeTimestamp(System.currentTimeMillis()))\n                    .build()\n                val fixedAdvice = IntegrityAdvice.Builder()\n                    .advices(intermediateIntegrityResponse.integrityAdvice?.advices.ensureContainsLockBootloader())\n                    .build()","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/vending-app/src/main/kotlin/com/google/android/finsky/expressintegrityservice/ExpressIntegrityService.kt#L195-L231","documentation":"warmUpIntegrityToken throws StandardIntegrityException with the message 'Server-specified exception' when the intermediate integrity server response reports a WARMUP test error. The server-provided errorCode from the warmup response is wrapped into a StandardIntegrityException and rethrown to the caller. It signals the integrity token warmup failed on the server side.","triggerScenarios":"Calling warmUpIntegrityToken while the intermediateIntegrityResponse carries errorInfo with a non-null errorCode and testErrorType == TestErrorType.WARMUP.","commonSituations":"Server-side test/error injection for warmup requests; backend flags the device or session as failing warmup attestation; Play services returns an error code for the warmup token request.","solutions":["Check the StandardIntegrityException errorCode to identify the server-reported cause and address it per Play Integrity error docs","Verify the device has Play Protect certification and Google Play services is up to date","Retry warmup after confirming network connectivity and device integrity","If triggered by test error injection (TestErrorType.WARMUP), remove the test configuration on the server"],"exampleFix":"// before\nthrow StandardIntegrityException(error.errorCode, \"Server-specified exception\")\n// after\ntry {\n    integrityManager.requestIntegrityToken(request)\n} catch (e: StandardIntegrityException) {\n    Log.w(TAG, \"warmup failed: ${e.errorCode}\") // inspect errorCode before retrying\n}","handlingStrategy":"try-catch","validationCode":"// No pre-call check: server decides. Ensure device is Play Protect certified first.\nval certified = GooglePlayServicesUtil.isGooglePlayServicesAvailable(context) == ConnectionResult.SUCCESS","typeGuard":null,"tryCatchPattern":"try {\n    warmUpIntegrityToken()\n} catch (e: StandardIntegrityException) {\n    Log.w(TAG, \"warmup server error: ${e.errorCode}\")\n    // schedule retry with backoff\n}","preventionTips":["Keep Google Play services updated on test devices","Remove server-side warmup test-error injection before production testing","Warm up the token in advance so transient server failures can be retried"],"tags":["kotlin","play-integrity","server-error","warmup"],"backgroundTag":"upstream-api-error","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"}