Code
14
SDK error · code 14
What it means
invalidAppUserIdError (code 14) means the app user ID is empty, too long, or missing from the device. The backend answers 7220 or 7256, and the SDK raises it when logIn gets an empty or blank ID. Pass a non-empty string of at most 100 characters to logIn, never an empty string, and make sure your own user ID is loaded before you call it.
Code
14
iOS (Swift)
ErrorCode.invalid
Android (Kotlin)
PurchasesErrorCode.Invalid
Causes
logIn was called with an empty or whitespace-only ID. The iOS SDK trims the ID first, and the Android SDK checks for a blank one (IdentityManager.swift).null or an unloaded value, for example a user ID read before sign-in finished.| Backend code | Meaning |
|---|---|
| 7220 | Empty app user ID. |
| 7256 | Invalid app user ID. |
Fix
Call logIn only when you have a real, non-empty user ID. Wait for your own sign-in to finish first.
Use a stable ID of at most 100 characters, such as your database user ID. Do not use an email address that can change, and never a value that is shared between people.
Leave anonymous users anonymous. Call logIn only after real sign-in, and logOut on sign-out.
If the SDK lost its stored ID, call logIn again with your own ID so the customer maps back to the right customer record.
In your app
// Swift
do {
let result = try await Purchases.shared.purchase(package: package)
} catch let error as ErrorCode where error == .invalidAppUserIdError {
// handle invalid app user id
}
// Kotlin
if (error.code == PurchasesErrorCode.InvalidAppUserIdError) { /* ... */ } On RevenueDot: RevenueDot answers HTTP 400 with code 7220 when app_user_id is empty or longer than 100 characters. Anonymous IDs start with $RCAnonymousID:, and logging in moves purchases made as an anonymous user to the new ID. See Why is my entitlement not active?.
FAQ
A non-empty string. On RevenueDot it can be at most 100 characters. Use your own stable user ID, not an email that can change.
The ID you passed is empty or only whitespace, or the server rejected it as invalid. Check that your user ID is loaded before you call logIn.
In React Native, compare error.code with PURCHASES_ERROR_CODE.INVALID_APP_USER_ID_ERROR. In Flutter, convert the PlatformException with PurchasesErrorHelper.getErrorCode(e) and compare the result with PurchasesErrorCode.invalidAppUserIdError.
Get started
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