twilio-34202Twiliomedium

Call Recording Failed

Recording could not be started or completed for this call.

What this error means

Error 34202 indicates that Twilio attempted to initiate or continue a call recording but the operation failed. This can happen when recording is requested via the <Record> TwiML verb, the recording=true parameter on an outbound call, or the Twilio REST API Recordings endpoint — and the recording could not be saved. Possible causes range from account-level recording restrictions and storage quota issues to transient infrastructure problems on Twilio's recording infrastructure. The call itself may continue normally when this error occurs, but the recording will be absent or incomplete, which can create compliance or quality-assurance gaps.

Root causes

high

Recording functionality not enabled on the Twilio account or subaccount

Common

high

Twilio recording storage quota reached for the account

Occasional

medium

Recording requested on a call that has already been terminated or hung up

Occasional

medium

Transient infrastructure error on Twilio's recording service

Occasional

medium

Invalid recording parameters passed (unsupported format, invalid trim value, etc.)

Rare

medium

Attempting to record a call that uses an incompatible codec or media path (e.g., certain conferencing configurations)

Rare

How to fix it

  1. 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. 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. 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. 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. 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. 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. 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