Docs / Nosmai Effects / Reference / Errors and troubleshooting

Errors and troubleshooting

The SDK's error types and codes, what they mean, and how to fix common integration issues.

Error types

The SDK reports failures as typed errors. Each one carries a type, a human-readable message, and whether it is recoverable. Handle them by type.

// Flutter
try {
  await Nosmai.startRecording();
} on NosmaiError catch (e) {
  // e.type (NosmaiErrorType), e.userMessage, e.isRecoverable
}
// or listen continuously
nosmai.onError.listen((e) { /* e.type, e.userMessage */ });
// iOS: errors arrive as NSError in NosmaiErrorDomain (see codes below), and a
// notification is posted for global handling.
[[NSNotificationCenter defaultCenter] addObserver:self
    selector:@selector(onNosmaiError:) name:@"NosmaiErrorNotification" object:nil];
// Android: callbacks report a message on failure.
NosmaiEffects.applyEffect(path, new NosmaiEffects.EffectCallback() {
    @Override public void onSuccess() {}
    @Override public void onError(String message) { /* handle */ }
});
GroupTypeMeaning
GeneralunknownUnspecified error.
GeneralstateErrorCalled in the wrong state (for example before initialize).
GeneraloperationTimeoutThe operation timed out.
GeneralplatformErrorA native platform error.
GeneralnetworkErrorNetwork failed (license check or cloud filter).
GeneralinvalidParameterA parameter was out of range or invalid.
InitializationsdkNotInitializedUsed before initialize succeeded.
InitializationinvalidLicenseLicense key is wrong, revoked, or not for this app.
InitializationlicenseExpiredThe license or subscription has expired.
CameracameraPermissionDeniedCamera permission was not granted.
CameracameraUnavailableNo usable camera, or it is in use elsewhere.
CameracameraConfigurationFailedThe camera could not be configured.
CameracameraSwitchFailedSwitching front / back camera failed.
FilterfilterNotFoundThe .nosmai file or id was not found.
FilterfilterInvalidFormatThe file is not a valid .nosmai.
FilterfilterLoadFailedThe filter failed to load.
FilterfilterDownloadFailedA cloud filter download failed.
RecordingrecordingPermissionDeniedMicrophone or storage permission not granted.
RecordingrecordingStorageFullNot enough storage to record.
RecordingrecordingWriteFailedWriting the video file failed.
RecordingrecordingInProgressA recording is already running.

Native error codes

On iOS and Android, native errors use an NSError in NosmaiErrorDomain with one of these codes (useful when you switch on the integer code directly):

CodeNameMeaning
1000UnknownUnspecified error.
1001LicenseInvalidLicense key is wrong, revoked, or not for this app.
1002LicenseExpiredThe license or subscription has expired.
1003NetworkErrorNetwork failed (license check or cloud filter).
1004CameraPermissionDeniedCamera permission was not granted.
1005CameraNotAvailableNo usable camera.
1006EffectLoadFailedA filter or effect failed to load.
1007InitializationFailedThe engine failed to initialize.
1008ResourceNotFoundA required resource was not found.
1009InvalidParameterA parameter was invalid.
1010MemoryErrorOut of memory.
403FeatureNotEnabledThe feature is not enabled for this license.

License error codes

The license key is verified online on the first launch. When the licensing service rejects the request, it returns one of these codes. A wrong key or license problem must be fixed; TOO_MANY_REQUESTS, INTERNAL and NETWORK are transient, so retry with backoff.

CodeMeaning
API_KEY_INVALIDKey not found, wrong, or revoked.
LICENSE_EXPIREDThe license or subscription has expired.
PACKAGE_ID_MISMATCHThe key is for a different app (package name / bundle id).
PLATFORM_MISMATCHThe key is for a different platform.
SDK_VERSION_UNSUPPORTEDThis SDK version is not allowed.
MAU_LIMIT_EXCEEDEDThe monthly active user / device limit was reached.
DEVICE_NOT_REGISTEREDThe device is not registered for this key.
TIMESTAMP_INVALIDThe device clock is too far off. Fix the device time.
TOO_MANY_REQUESTSRate limited. Retry with backoff.
MISSING_FIELDSA required field is missing from the request.
INTERNALA server error. Retry later.
NETWORKThe device could not reach the licensing service.

Get and manage keys from the portal.

Permissions

  • Black or frozen preview. Confirm the camera permission is granted, and request it before starting the camera.
  • Recording fails. Add the microphone permission, plus the photo library permission if you save to the gallery.

Performance

  • Low frame rate. Test on a physical device, not an emulator or simulator. On lower-end devices, reduce the number of simultaneous effects.
  • Heat or battery drain in long sessions. The SDK adapts quality automatically; avoid stacking many heavy effects at once, and stop processing when the camera is not visible.

Filters

  • Filter does not load (filterNotFound / filterLoadFailed). For local filters, confirm the .nosmai files are bundled correctly: a folder reference in the iOS app target, or assets/filters/ on Android and Flutter.
  • Cloud filter unavailable (filterDownloadFailed). Check that cloud filters are enabled for your license, and download a filter before applying it.

Lifecycle

  • Preview is blank after navigating back (Flutter). Detach the camera view before leaving the screen and reinitialize the preview when returning.
  • Resources not released (Android). Call stopProcessing and the cleanup methods in onPause and onDestroy, and stop the camera helper.

Platform notes

  • iOS. Run on a physical device. The simulator does not provide a camera feed.
  • Android. Requires a physical arm64 device with Camera2 support.
Nosmai

We make advanced camera and AI technology accessible to every developer. By packaging hard problems into simple

developers
legal
newsletter

Product updates and release notes. No spam.

© 2026 nosmai, inc · all rights reserved