Installation Issues
Resource Fetcher Not Initialized
Error Message:ResourceFetcherAdapterNotInitialized (Code 186)
Cause: The resource fetcher was not initialized before using model hooks.
Solution:
For Expo projects:
Native Module Not Found
Error Message:Module not found or NativeModule.RNExecutorch is null
Solution for iOS:
New Architecture Not Enabled
Error Message: Architecture-related errors or feature not available Solution for Expo: Updateapp.json:
ios/Podfile:
android/gradle.properties:
Model Loading Issues
Model Not Loading (isReady stays false)
Symptoms:isReady stays false, downloadProgress not increasing
Debugging Steps:
- Network Issues: Check internet connectivity
- Invalid URL: Verify model URL is accessible
- Insufficient Storage: Check available device storage
- Resource Fetcher Not Initialized: See above
Download Fails or Interrupts
Error Message:ResourceFetcherDownloadFailed (Code 180) or DownloadInterrupted (Code 118)
Solution: Implement retry logic
Invalid Model File
Error Message:InvalidProgram (Code 35)
Causes:
- Corrupted download
- Wrong file format
- Model not properly exported
- Delete and re-download:
- Verify file is valid
.pteformat - Re-export model using correct ExecuTorch export process
Memory Issues
Out of Memory / App Crashes
Error Message:MemoryAllocationFailed (Code 33) or app crashes without error
Immediate Solution: Use quantized models
| Model | iOS Memory | Android Memory |
|---|---|---|
| LLAMA3_2_1B | 3.1 GB | 3.3 GB |
| LLAMA3_2_1B_SPINQUANT | 2.4 GB | 1.9 GB |
| LLAMA3_2_3B | 7.3 GB | 7.1 GB |
| LLAMA3_2_3B_SPINQUANT | 3.8 GB | 3.7 GB |
- Increase Android Emulator RAM: Set to 4GB+ in AVD Manager
- Enable large heap (Android):
- Use context strategies:
- Unload models when not needed:
Memory Warnings (iOS)
Solution: Handle memory warningsGeneration Issues
Model Not Generating (hangs)
Symptoms:generate() never completes, isGenerating stays true
Solution: Implement timeout and interrupt
Empty or Unexpected Responses
Causes:- Invalid input format
- Model not configured correctly
- Temperature/sampling issues
ModelGenerating Error
Error Message:ModelGenerating (Code 104)
Cause: Trying to run inference while model is already generating
Solution: Check isGenerating before calling
Input/Output Issues
FileReadFailed Error
Error Message:FileReadFailed (Code 114)
Causes:
- Invalid file path
- File doesn’t exist
- Unsupported image format
- Permissions issue
WrongDimensions Error
Error Message:WrongDimensions (Code 116)
Cause: Input tensor shape doesn’t match model’s expected shape
Solution: Verify input dimensions
TokenizerError
Error Message:TokenizerError (Code 167)
Causes:
- Tokenizer file missing or corrupted
- Tokenizer config missing
- Incompatible tokenizer
Platform-Specific Issues
iOS Simulator Issues
Problem: Slow performance or crashes on simulator Solution: Test on real devices. Simulators don’t reflect actual performance. For basic testing on simulator:Android Emulator Performance
Problem: Slow inference or OOM on emulator Solution: Increase emulator resources- Open Android Studio
- Tools → AVD Manager
- Edit your virtual device
- Show Advanced Settings
- Set RAM to 4096 MB or higher
- Set VM heap to 512 MB
- Enable hardware acceleration
iOS Build Errors
Problem: CocoaPods errors or build failures Solution:Android Build Errors
Problem: Gradle errors or dependency conflicts Solution:Performance Issues
Slow Inference Speed
Solutions:- Use quantized models:
- Reduce generation length:
- Limit context:
- Use appropriate backends: Ensure model was exported with XNNPACK or Core ML
Slow Downloads
Solution: Pre-download models and cache themDebugging Best Practices
Enable Comprehensive Logging
Check Model Files
Profile Performance
Getting Help
If you’re still experiencing issues:- Check Documentation:
- Search Existing Issues: GitHub Issues
- Ask the Community: GitHub Discussions
-
Report a Bug: Include:
- React Native ExecuTorch version
- React Native version
- Platform (iOS/Android) and version
- Minimal reproduction code
- Error messages and logs
- Device specs (RAM, OS version)
Quick Checklist
When encountering issues, verify:- Resource fetcher is initialized
- New Architecture is enabled
- Model is downloaded (check
downloadProgress) - Model is loaded (check
isReady) - No errors (check
errorstate) - Sufficient device memory for model
- Input format matches model requirements
- Testing on real device, not just emulator
- Using latest version of React Native ExecuTorch
Next Steps
- Review Debugging Guide for advanced techniques
- Learn about Memory Management
- Optimize with Performance Guide