Errors

Every error code of the SDKs: what happened and what to do about it.

Every failure in the SDKs is one error type with a code, a message, one sentence about what to do, and a link to its entry here. The codes are the same on Android, Apple, the web and in C. The messages and the lines about what to do are in English, exactly as the SDK prints them.

26 codes, SDK 3.0.0

invalid_argument

Message
Invalid argument: {detail}.
What to do
Pass a value the API accepts: a context or head name the model lists, a sample rate the SDK can resample, a surah from 1 to 114 with ayahs inside it, a rule name of lower-case letters, digits and underscores.

invalid_key

Message
Quran Lab does not accept this key.
What to do
Copy the key for this app and platform again from sdk.quranlab.ai; a revoked key has to be replaced by a new one there.
On the device
When the server answered that the key is revoked or unknown, the SDK also stops running the model and removes it from the device. Once the server accepts a key again, the model downloads again, as on a first install.

sdk_too_old

Message
This key needs SDK {version} or later; this is {sdk}.
What to do
Upgrade the TajweedFormer SDK to {version} or later (the min_sdk of the server's answer), with the install line of the README.

server_rejected

Message
Quran Lab refused this app: {detail}.
What to do
Check in sdk.quranlab.ai that the key belongs to this app id and platform and that the app is not blocked.

When the refusal names one of these reasons, the error keeps this code and gives the reason's own message and fix.

Reason
developer_not_approved
Message
The account behind this key has no access to Quran Lab yet (developer_not_approved).
What to do
Open https://sdk.quranlab.ai/start with the account that owns the key and finish the access request; the key works as soon as access is given.
On the device
The SDK also stops running the model and removes it from the device. Once the server accepts the key and the app again, the model downloads again, as on a first install.
Reason
not_a_member
Message
The account that made this key is not a member of the workspace that owns the app (not_a_member).
What to do
Ask an owner of that workspace on sdk.quranlab.ai to add the account, or make a new key from an account that is a member.
Reason
key_type_mismatch
Message
This key is of the wrong type for this platform (key_type_mismatch).
What to do
Use an apps key on Android and iOS, a desktop key on macOS, Windows and Linux, and a web key in a browser page; sdk.quranlab.ai makes each of them under the same app.
On the device
The SDK also stops running the model and removes it from the device. Once the server accepts the key and the app again, the model downloads again, as on a first install.
Reason
origin_not_allowed
Message
This page's origin, {origin}, is not on the key (origin_not_allowed).
What to do
Add this page's origin (scheme, host and port, for example https://app.example.org) to the key on its page at https://sdk.quranlab.ai/keys.
On the device
The SDK also stops running the model and removes it from the device. Once the server accepts the key and the app again, the model downloads again, as on a first install.
Reason
app_not_allowed
Message
This key belongs to another app (app_not_allowed).
What to do
A key works for the first app that used it. Make a key for this app at https://sdk.quranlab.ai/keys, or allow this app's identifier on the key's page.
On the device
The SDK also stops running the model and removes it from the device. Once the server accepts the key and the app again, the model downloads again, as on a first install.
Reason
app_blocked
Message
Quran Lab does not serve this app at the moment: it is blocked by Quran Lab or paused by its developer (app_blocked).
What to do
Open the app's page on sdk.quranlab.ai: unpause the app there, or read the reason for the block and write to Quran Lab from the account that owns the app.
On the device
The SDK also stops running the model and removes it from the device. Once the server accepts the key and the app again, the model downloads again, as on a first install.
Reason
environment_mismatch
Message
This key's environment (development or production) does not match this app (environment_mismatch).
What to do
Use the development key in the builds you run yourself and the production key in the build you publish; both are on the app's page on sdk.quranlab.ai.
Reason
local_needs_development_key
Message
This page runs on {origin}, and a production key does not work on a local address (local_needs_development_key).
What to do
Use this app's development key for local work, with http://localhost:* among its origins (https://sdk.quranlab.ai/keys); keep the production key for the deployed site.
Reason
model_attestation_required
Message
Quran Lab could not confirm that this is the app as its store delivers it, running on a real device, and does not send it the model (model_attestation_required).
What to do
Run the app as the store or TestFlight installs it, on a real device: a simulator, an emulator and a changed app or device cannot be confirmed. While you develop, use this app's development key, which is not asked for this.
Reason
model_not_allowed
Message
Quran Lab does not send model files to this platform at the moment (model_not_allowed).
What to do
Nothing in the app is wrong. See sdk.quranlab.ai for the state of this platform, or write to Quran Lab from the account that owns the app.

client_exists

Message
This process already has a TajweedClient.
What to do
Keep the first client and reuse it, or close it before making another.

model_unavailable

Message
Quran Lab has no model build for SDK {sdk} yet.
What to do
Nothing to change in the app: call model() again later, and check client.diagnose() and sdk.quranlab.ai for the model builds of this SDK version.

needs_connection

Message
The model is not on this device yet.
What to do
Connect once so the model can be downloaded; call prefetch() at app start so later starts work offline.

network_not_permitted

Message
This app is not allowed to use the network.
What to do
Android: keep the INTERNET permission that the SDK's manifest declares (take out a tools:node="remove" for android.permission.INTERNET). A sandboxed Mac app: turn on Outgoing Connections (Client) under App Sandbox.

download_failed

Message
The model download stopped: {detail}.
What to do
Call model() or prefetch() again when the network is back; the download resumes where it stopped.

storage_full

Message
Not enough free space for the model: {needed} bytes needed, {available} free.
What to do
Free that much space on the device, or call removeModels() to drop model versions that are no longer used.

storage_failed

Message
The SDK's folder cannot be read or written: {detail}.
What to do
Give the client a storage folder the app can write to, and make sure only one process uses it.

model_missing

Message
No model here: {detail}.
What to do
Let client.model() download the model: a model comes from Quran Lab's server through the Client, and a model folder that the Client did not download itself is not opened.

model_invalid

Message
The model folder is damaged: {detail}.
What to do
Call removeModels() and then model() to download the model again.

signature_invalid

Message
The model's manifest is not signed by Quran Lab.
What to do
Use only model files from cdn.quranlab.ai; call removeModels() and then model() to download them again.

checksum_mismatch

Message
A model file differs from the manifest: {file}.
What to do
Call removeModels() and then model() to download the model again; if it repeats, the storage is failing.

model_incompatible

Message
This model build does not run on this SDK: {detail}.
What to do
Upgrade the SDK to the version the message names, or let client.model() pick the build for this SDK instead of opening a folder.

runtime_unsupported

Message
The SDK cannot run here: {detail}.
What to do
Run the app where the SDK is supported: {minimum}.

reference_missing

Message
The reference data is not on this device.
What to do
Call model.reference.fetch() once, with a connection, before asking for units.

session_open

Message
This model already has an open session.
What to do
Finish or cancel the open session before starting the next take.

session_closed

Message
The session has ended.
What to do
Start a new session with model.listen() or model.session() for the next take.

cancelled

Message
The take was cancelled.
What to do
Nothing to fix: cancel() was called, or the app's task was cancelled; start a new session for the next take.

engine_failed

Message
The engine failed: {detail}.
What to do
Call client.diagnose() and send the report to Quran Lab; a new session on the same model can be tried.

microphone_denied

Message
The microphone permission was refused.
What to do
Explain why the app listens and send the learner to the system settings; listen() asks again only where the platform allows it.

microphone_unavailable

Message
No microphone can be opened: {detail}.
What to do
Check that the device has an input and no other app holds it, then call listen() again.

interrupted

Message
The take ended on an interruption: {detail}.
What to do
Start a new session when the app has the audio again; what was heard so far is in the last chunk.

sharing_unavailable

Message
Sharing is not available for this app.
What to do
Nothing to call: Quran Lab switches sharing on per app; check client.sharing.isAvailable before showing sharing settings.