SDK error · code 16

unknownBackendError (error code 16): Unknown backend error

What it means

unknownBackendError (code 16) means the server answered with an error code the SDK has no specific mapping for. The original number is in the error: read rc_backend_error_code on iOS, or the "Backend Code" text on Android. On iOS, backend codes 7110, 7226, 7259 and the Play codes also land here. Look the number up, fix that cause, and do not grant access.

Code

16

iOS (Swift)

ErrorCode.unknownBackendError

Android (Kotlin)

PurchasesErrorCode.UnknownBackendError

Causes

Why the SDK returns unknownBackendError

  • The response carried a code that is not in the SDK's table, or no numeric code at all. The SDK then reports unknownBackendError with the original code appended to the message (ErrorResponse.swift).
  • iOS maps these known backend codes here too: 7110 (internal server error), 7226 (bad request), 7259 (subscription not found for customer), 7107, 7229, 7230 and 7231 (BackendErrorCode.swift).
  • Android: any code missing from its BackendErrorCode list gives UnknownBackendError with the text "Backend Code: N" and the server message (errors.kt). That includes 7259 and 7877.
  • A server newer than the SDK, which answers codes the SDK was not built for.
Backend codeMeaning
7110Internal server error. iOS maps it to unknownBackendError; Android maps it to unexpectedBackendResponseError.
7226Bad request. iOS maps it to unknownBackendError; Android maps it to unexpectedBackendResponseError.
7259Subscription or object not found. iOS maps it to unknownBackendError; Android has no mapping, so it also gives unknownBackendError.
7229Play Store quota exceeded. iOS maps it to unknownBackendError; Android maps it to storeProblemError.
7231Play Store generic error. iOS maps it to unknownBackendError; Android maps it to storeProblemError.

Fix

How to fix unknownBackendError

  1. 01

    Find the original code

    On iOS, read rc_backend_error_code and rc_response_status_code from userInfo. On Android, read the number after "Backend Code" in underlyingErrorMessage.

  2. 02

    Look up the number

    Search it in the table of RevenueDot's API errors. The message the server sent explains the cause.

  3. 03

    Fix the underlying cause

    For a 7259, create or fix the customer, entitlement or offering that does not exist. For a 7110, read the server log.

  4. 04

    Update the SDK

    A newer SDK maps more backend codes to specific errors, which makes the cause easier to see.

In your app

How to handle it in code

  • A single retry is reasonable for a 5xx, because 7110 can be temporary. Do not retry a 4xx.
  • Show a generic error and log the original backend code with the request path.
  • Do not grant access from the error.
Match the errorSwift · Kotlin
// Swift
do {
  let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .unknownBackendError {
  // handle unknown backend error
}

// Kotlin
if (error.code == PurchasesErrorCode.UnknownBackendError) { /* ... */ }

On RevenueDot: RevenueDot answers 7259 (404) when a customer, entitlement, offering or subscription does not exist, 7226 (400) for parameters it cannot use, 7110 (500) for unexpected failures, and 7877 (400) for an unknown Web Billing checkout session. All of them reach the SDK as this error on iOS. See what RevenueDot's API errors mean.

FAQ

unknownBackendError: questions people ask

How do I find the real code behind unknownBackendError?

On iOS read rc_backend_error_code in the error's userInfo. On Android read the number after "Backend Code" in the underlying message. Then look it up in the server's error table.

Is unknownBackendError a server outage?

Not by itself. It means the SDK has no specific name for the code the server sent. Check the status code: a 5xx points to a server problem, a 4xx to a bad request or a missing object.

How do I check for unknownBackendError in React Native and Flutter?

In React Native, compare error.code with PURCHASES_ERROR_CODE.UNKNOWN_BACKEND_ERROR. In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.unknownBackendError.

Get started

Keep the RevenueCat SDK. Change the backend.

RevenueDot answers the same SDK calls with the same error codes. Start free on RevenueDot Cloud, free up to $10,000 a month in tracked revenue.

Already have an account? Sign in · Prefer your own servers? Self-host free