Model Setup Issues
Model directory does not exist
Symptoms: Error message “Model directory does not exist” when initializing STT or TTS. Solutions:Bundled assets
Bundled assets
- Check the asset path (e.g.
models/your-folder) and that the folder is actually in the app’s assets - Android: Ensure folder is in
assets/models/ - iOS: Verify folder reference in the app target, Copy Bundle Resources
- Rebuild the app after adding models
Play Asset Delivery (PAD)
Play Asset Delivery (PAD)
- Ensure the app was installed with the asset pack (e.g. via
installDebugWithPador the release AAB) - Check if
getAssetPackPath()returnsnull - If
null, use a fallback path (e.g.DocumentDirectoryPath) and put models there
File system path
File system path
- Ensure the path is absolute and the folder exists on disk
- Verify the folder was created after download or extraction
- Check file permissions
Cannot auto-detect model type
Symptoms: Initialization fails with “Cannot auto-detect model type” error. Solutions:-
Verify required files: Ensure the folder contains the required files for at least one model type:
- Whisper:
encoder.onnx,decoder.onnx,tokens.txt - Transducer:
encoder.onnx,decoder.onnx,joiner.onnx,tokens.txt - VITS:
model.onnx,tokens.txt,lexicon.txt - Zipvoice:
encoder.onnx,decoder.onnx,vocoder.onnx(vocos/hifigan)
- Whisper:
- File names are case-sensitive: Ensure exact file names match requirements
-
Use explicit model type if detection fails:
getAssetPackPath() returns null
Symptoms: Cannot access models from Play Asset Delivery. Solutions:- The app was not installed from a bundle that includes the asset pack
- Install via the AAB:
yarn android:pador use bundletool - Plain
installDebugdoes not include the pack - Use on-demand download if pack is not installed:
Audio Format Issues
STT: Audio format not supported
Symptoms: Recognition fails or produces incorrect results. Requirements: STT expects WAV, 16 kHz, mono, 16-bit PCM Solutions:-
Convert audio files using FFmpeg:
-
Use built-in conversion (if FFmpeg not disabled):
-
Check audio properties:
TTS: Playback issues
Symptoms: TTS audio doesn’t play or sounds distorted. Solutions:-
Use correct sample rate returned by TTS:
-
Convert float samples for playback:
Build Issues
Android: bundletool not found (PAD)
Symptoms: Error when runninginstallDebugWithPad.
Solutions:
- Add
bundletooltoPATH - Or pass path explicitly:
./gradlew installDebugWithPad -Pbundletool=/path/to/bundletool - Download bundletool: https://github.com/google/bundletool/releases
iOS: Framework or headers not found
Symptoms: Build fails with missing framework or header errors. Solutions:-
Run pod install:
-
Verify XCFramework:
- Ensure sherpa-onnx XCFramework is downloaded
- Check
ios/Frameworks/sherpa_onnx.xcframeworkexists - If building locally, place framework in this location
-
Clean build:
JNI libraries not found (Android)
Symptoms: App crashes with “couldn’t find DSO to load” or similar. Solutions:-
Check library paths: Ensure prebuilt libraries are in correct location:
-
Verify ABI compatibility: Check your
build.gradleincludes required ABIs:
Performance Issues
Slow inference / High RTF
Symptoms: Real-time factor (RTF) > 1.0, processing slower than real-time. Solutions:-
Enable hardware acceleration:
-
Use quantized models:
- Switch from FP32 to INT8 models
- Example: Use
sherpa-onnx-zipvoice-distill-int8instead of full model
-
Adjust thread count:
- See Performance Optimization for detailed tips
High memory usage / Out of memory
Symptoms: App crashes with OOM error, especially with large models. Solutions:-
Use smaller models:
-
Release resources when done:
-
Check memory before loading:
Execution Provider Issues
QNN not available
Symptoms:getQnnSupport().canInit returns false.
Solutions:
Add QNN runtime libraries
- Download Qualcomm AI Runtime from Qualcomm Software Center
- Copy
.sofiles toandroid/app/src/main/jniLibs/arm64-v8a/ - Required files:
libQnnHtp.so,libQnnHtpV*Stub.so,libQnnSystem.so, etc.
NNAPI session fails
Symptoms:getNnapiSupport().canInit returns false but providerCompiled is true.
Solutions:
- This can be model-specific: some models may not be compatible with NNAPI
- Try with a different model or use CPU fallback:
- Check Android version: NNAPI requires Android 8.1+
Download Manager Issues
Model download fails
Symptoms:downloadModelByCategory() promise rejects.
Solutions:
- Check network connectivity
- Verify model ID: Ensure the model ID is correct:
- Check disk space: Ensure sufficient storage available
- Handle errors gracefully:
Archive extraction fails
Symptoms: Download completes but model is not usable. Solutions:-
Check if libarchive is disabled:
- If
sherpaOnnxDisableLibarchive=trueis set, archive models won’t work - Solution: Remove the flag or use single-file models (
.onnx)
- If
-
Verify downloaded file:
- See Disable libarchive for details
Runtime Errors
”FFmpeg not available” error
Symptoms:convertAudioToWav16k() returns error.
Cause: FFmpeg is disabled via sherpaOnnxDisableFfmpeg=true.
Solutions:
-
Remove the flag if you need audio conversion:
-
Use external conversion:
- Use another library for audio conversion
- Or provide pre-converted audio files
- See Disable FFmpeg for details
Invalid language code crashes (Whisper)
Symptoms: App crashes when using Whisper with invalid language code. Solutions:-
Use valid language codes:
-
Build language selector:
Zipvoice initialization fails
Symptoms: Error when initializing Zipvoice TTS model. Cause: Vocoder file missing (encoder + decoder only models not supported). Solutions:-
Verify model includes vocoder:
- Check for
vocos_24khz.onnxorhifigan.onnxin model directory - Distill models without vocoder will fail
- Check for
-
Use complete Zipvoice model:
Symbol Clashes
Multiple FFmpeg libraries crash
Symptoms: App crashes with undefined behavior when using multiple libraries with FFmpeg. Solutions:-
Disable FFmpeg in Sherpa-ONNX:
- See Disable FFmpeg for details
Multiple libarchive libraries conflict
Symptoms: Symbol conflicts when multiple libraries include libarchive. Solutions:-
Disable libarchive in Sherpa-ONNX:
- See Disable libarchive for details
Getting Help
GitHub Issues
Report bugs or request features
Documentation
Browse the full documentation
Examples
Check example implementations
Upstream Docs
Sherpa-ONNX C++ documentation
Debug Checklist
When troubleshooting issues, check:- Model files are present and complete
- Audio format matches requirements (16kHz, mono, 16-bit PCM for STT)
- Sufficient memory available (check device RAM)
- Correct execution provider for device
- Native libraries present for target ABI
- No conflicting native dependencies
- Latest SDK version installed
- Clean rebuild after configuration changes