Skip to main content

LCP errors

Every LCP call rejects with an LcpError:

import { LCP, LcpError } from 'react-native-readium-lcp';

try {
await LCP.acquirePublication({ url });
} catch (e) {
if (e instanceof LcpError) Alert.alert("Couldn't add this book", e.message);
}
Field
codeAn LcpErrorCode, the same on both platforms. Branch on it.
messagePlain English, written for users: "This license was revoked by its provider on October 1, 2026."
date, devicesCount, maxRenewDateWhat the message mentions, for apps that word or translate it themselves.
detailReadium's own description, for logs.

describeLcpError(code, details) returns the same message for a code you already have, such as a license's restriction.

A book that can't be unlocked while reading is reported by the reader, through ReadiumView's onPublicationError, as restricted or protectionNotSupported.

Codes​

The license​

CodeMeaning
licenseRevokedThe provider revoked the license.
licenseReturnedThe book was returned.
licenseCancelledThe license was cancelled.
licenseExpiredThe loan ended.
licenseNotStartedThe loan hasn't started yet.
licenseIntegrityThe license is damaged, or wasn't issued by a trusted provider.
licenseProfileNotSupportedThe license uses an LCP profile the linked liblcp doesn't support.
missingPassphraseNo passphrase was given.
notALicenseDocument, parsingNot a valid LCP license.
licenseIsBusyThe license is in use; try again.
licenseContainerThe license couldn't be read from or written to the book's file.
licenseInteractionNotAvailableThe license needs an action that isn't available.

Loans​

CodeMeaning
invalidRenewalPeriodThe requested end date is past maxRenewDate.
renewFailedThe loan couldn't be renewed.
alreadyReturnedOrExpiredThe book was already returned, or its loan ended.
returnFailedThe book couldn't be returned.

Network​

CodeMeaning
networkThe license server couldn't be reached.
crlFetchingThe certificate revocation list couldn't be downloaded. Check the cleartext HTTP setup.

Setup and platform​

CodeMeaning
notInitializedCall LCP.initialize() first.
registryUnavailableLCP couldn't connect to react-native-readium.
unsupportedNot available on this platform, such as forgetPassphrases on Android.
openFailedThe file couldn't be opened.
addPassphraseFailed, forgetPassphrasesFailedStoring or removing passphrases failed.
unknownAnything else; see detail.