twilio-34202TwiliomediumCall Recording Failed
Recording could not be started or completed for this call.
What this error means
Root causes
Recording functionality not enabled on the Twilio account or subaccount
Common
Twilio recording storage quota reached for the account
Occasional
Recording requested on a call that has already been terminated or hung up
Occasional
Transient infrastructure error on Twilio's recording service
Occasional
Invalid recording parameters passed (unsupported format, invalid trim value, etc.)
Rare
Attempting to record a call that uses an incompatible codec or media path (e.g., certain conferencing configurations)
Rare
How to fix it
- 1
Verify recording is enabled on your Twilio account
Log into the Twilio Console and navigate to Voice > Settings > General. Confirm that call recording is enabled for your account or subaccount. Some trial accounts and subaccounts may have recording disabled by default.
- 2
Check account recording storage and usage
Review your recording storage usage in the Twilio Console under Monitor > Usage > Recording. Twilio imposes storage limits based on your account tier. If you are near the limit, delete old recordings via the REST API or configure automatic deletion policies.
- 3
Validate recording parameters in TwiML or API calls
Check the recording parameters you are passing. For <Record>, ensure 'recordingFormat' is either 'mp3' or 'wav'. For API-initiated recordings, ensure 'trim' is 'trim-silence' or 'do-not-trim', and 'recordingChannels' is 'mono' or 'dual'.
// TwiML — correct <Record> verb with valid attributes const twiml = new twilio.twiml.VoiceResponse(); twiml.record({ action: `${process.env.BASE_URL}/recording-complete`, method: 'POST', maxLength: 3600, recordingStatusCallback: `${process.env.BASE_URL}/recording-status`, recordingStatusCallbackMethod: 'POST', trim: 'trim-silence', recordingFormat: 'mp3' }); - 4
Handle 34202 in your recordingStatusCallback
Configure a recordingStatusCallback URL to receive recording status events. When the status is 'failed', log the error with the CallSid and RecordingSid for investigation. Alert your operations team so compliance gaps are surfaced immediately.
app.post('/recording-status', (req, res) => { const { RecordingStatus, RecordingSid, CallSid, ErrorCode } = req.body; if (RecordingStatus === 'failed') { console.error('Recording failed', { callSid: CallSid, recordingSid: RecordingSid, errorCode: ErrorCode }); // Alert compliance team if recording is required if (isRecordingMandatory(CallSid)) { notifyComplianceTeam({ callSid: CallSid, error: ErrorCode }); } } if (RecordingStatus === 'completed') { console.info('Recording completed', { callSid: CallSid, recordingSid: RecordingSid }); queueRecordingProcessing(RecordingSid); } res.sendStatus(200); }); - 5
Retry recording for long-lived calls using the REST API
For calls where recording is critical, implement a retry mechanism that uses the Twilio REST API to initiate a new recording if the first attempt fails. Poll the call status to confirm the call is still active before retrying.
async function startRecordingWithRetry(callSid, maxAttempts = 3) { for (let attempt = 1; attempt <= maxAttempts; attempt++) { try { const recording = await client.calls(callSid).recordings.create({ recordingChannels: 'dual', trim: 'do-not-trim' }); console.log(`Recording started: ${recording.sid}`); return recording; } catch (err) { if (err.code === 34202 && attempt < maxAttempts) { console.warn(`Recording attempt ${attempt} failed, retrying...`); await new Promise(resolve => setTimeout(resolve, 1000 * attempt)); } else { throw err; } } } } - 6
Configure recording storage export to your own S3 or cloud bucket
To avoid storage quota issues and ensure long-term retention, configure Twilio to export recordings directly to your own AWS S3, Google Cloud Storage, or Azure Blob Storage. Set this up under Console > Recordings > Storage and configure your cloud storage credentials.
- 7
Monitor recording failure rate via Twilio Debugger and Insights
Enable Twilio Insights for your account and monitor recording failure events in the Voice Insights dashboard. Set up event triggers in the Twilio Console to notify you when recording failures exceed a threshold. Track RecordingStatus='failed' events in your recordingStatusCallback over time to identify patterns.
Prevention
Prevent 34202 errors by proactively monitoring recording storage quotas and setting up automated cleanup or export jobs to prevent quota exhaustion. Configure your cloud storage integration to export recordings automatically so quota limits on Twilio's side do not block recording. Implement a mandatory recordingStatusCallback on all calls that require recording, and build alerting into that callback for any 'failed' status. Test recording end-to-end in staging before deploying new call flows. For compliance-critical use cases, implement a dual-recording strategy: record both via TwiML and via a separate API call shortly after the call connects, so a failure in one path does not result in a complete absence of recording.
Debugging this right now?
Sherlock diagnoses twilio-34202 automatically. Just ask in Slack and get an instant root-cause analysis.
Add to Slack — Free