Modal Issues
Cold Starts
Problem: First TTS request after inactivity takes 15-30 seconds and may timeout. Cause: Modal provisions a GPU container on-demand. The Chatterbox model is ~3GB and takes time to load into VRAM.Solution: Increase Client Timeout
Solution: Increase Client Timeout
Configure your HTTP client to allow longer timeouts for the first request:Or handle cold starts gracefully in your UI:
src/lib/chatterbox.ts
Solution: Keep Modal Warm
Solution: Keep Modal Warm
Send periodic health checks to prevent scale-down:
Solution: Optimize Scale-Down Window
Solution: Optimize Scale-Down Window
Adjust the Redeploy with
scaledown_window in chatterbox_tts.py:chatterbox_tts.py
modal deploy chatterbox_tts.py.Modal Deployment Fails
Problem:modal deploy fails with authentication or permission errors.
Solutions:
Voice Not Found Error
Problem: Modal returnsVoice not found at 'voices/system/...'.
Cause: The R2 bucket mount can’t find the voice file, or the path is incorrect.
Verify Voice Exists in R2
Verify Voice Exists in R2
Check your R2 bucket contains the voice files:System voices should be seeded by
npx prisma db seed.Check Database Records
Check Database Records
Verify voices have Look at the
r2ObjectKey populated:Voice table. Each voice should have an r2ObjectKey like voices/system/<id> or voices/custom/<id>.Re-run Seed Script
Re-run Seed Script
scripts/system-voices/*.wav to R2 and updates the database.Modal API Key Invalid
Problem: Modal returns403 Invalid API key.
Solution: The X-Api-Key header must match the CHATTERBOX_API_KEY secret in Modal:
modal deploy chatterbox_tts.py
Database Issues
Migration Fails
Problem:npx prisma migrate deploy fails with connection errors.
Check DATABASE_URL
Check DATABASE_URL
Verify the connection string format:
SSL Mode Required
SSL Mode Required
Most managed Postgres providers require SSL:
Connection Pooling
Connection Pooling
Prisma Postgres uses connection pooling by default. Other providers may need:
Prisma Client Not Generated
Problem: Import errors for@prisma/client or generated types.
Solution: The postinstall script should run automatically, but you can trigger it manually:
src/generated/prisma/client (configured in prisma/schema.prisma:8).
Seed Script Fails
Problem:npx prisma db seed fails with R2 upload errors.
Check R2 Credentials
Verify
R2_ACCOUNT_ID, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY, and R2_BUCKET_NAME are correct.R2 Storage Issues
Audio Upload Fails
Problem: Custom voice cloning fails with “Failed to upload audio” error.Check CORS Configuration
Check CORS Configuration
R2 bucket needs CORS enabled for client uploads (if using presigned URLs):Apply in Cloudflare R2 dashboard under bucket settings.
Verify R2 Permissions
Verify R2 Permissions
The R2 API token needs these permissions:
- Object Read
- Object Write
- Object Delete (optional, for cleanup)
Check File Size Limits
Check File Size Limits
Next.js proxy has a 20MB body size limit (configured in
next.config.ts:8). Audio files must be under this limit.The voice cloning requires at least 10 seconds of audio. Typical WAV files are 1-5MB.Audio Playback Fails
Problem: Generated audio won’t play in browser.Check Audio Proxy Route
Check Audio Proxy Route
Resonance proxies audio through Should return
/api/audio/[id] to avoid CORS issues. Verify:Content-Type: audio/wav or audio/mpeg.Verify R2 Object Exists
Verify R2 Object Exists
Check the database
Generation record has a valid r2ObjectKey, and the object exists in R2:Browser MIME Type Issues
Browser MIME Type Issues
Some browsers are strict about audio MIME types. The WAV files from Chatterbox should have:
Content-Type: audio/wav- Valid WAV header (22050 Hz sample rate)
Build & Runtime Issues
Build Fails: Environment Validation
Problem: Build fails with “Invalid environment variables” error. Solution: All required env vars must be set at build time. The validation schema is insrc/lib/env.ts:5-20.
Runtime Error: tRPC Procedure Failed
Problem: tRPC mutations fail with generic error messages.Check Server Logs
Check Server Logs
The actual error is logged server-side. Check your hosting platform’s logs:
Common Causes
Common Causes
- Database connection failed: Check
DATABASE_URL - R2 credentials invalid: Verify R2 env vars
- Modal timeout: See Cold Starts
- Clerk session invalid: User needs to re-authenticate
Clerk Organizations Not Working
Problem: Users can’t create organizations or see org-specific data.Verify Middleware
Clerk middleware must be configured to protect routes. Check
middleware.ts exists and includes:Performance Issues
Slow TTS Generation
Problem: Audio generation takes longer than expected (>10 seconds after warm start). Causes:- Long text: Chatterbox processes ~50 characters/second. 500 characters = ~10 seconds.
- High parameters: Lower
temperature,top_k, orrepetition_penaltyfor faster generation. - Modal concurrency: If
max_inputs=10is reached, requests queue.
Optimize Generation Parameters
Optimize Generation Parameters
Scale Modal Concurrency
Scale Modal Concurrency
Increase Redeploy:
max_inputs in chatterbox_tts.py:modal deploy chatterbox_tts.pyHigh Memory Usage
Problem: Next.js app uses excessive memory or crashes. Solution: The Prisma client and tRPC context can accumulate in memory. Use connection pooling and limit concurrent requests:next.config.ts
Getting Help
GitHub Issues
Report bugs or request features
Deployment Overview
Review prerequisites and architecture
For Modal-specific issues, check Modal’s documentation or their Discord community.