TL;DR
Run it through Lookup; you probably have a landline or a malformed number. - 30006, landline or unreachable. Check registration status first, code second. - 21608, unverified number on a trial account. Either verify the number in the console or upgrade the account. Check E.164 formatting (leading +, country code, no spaces or dashes in the API value).
When to use
You are seeing this: When a Twilio send fails, the error code is the diagnosis. Use this skill when you run into "Twilio messaging error codes: what 30007, 21608, 21614, 30006, 21211 mean".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Twilio messaging error codes: what 30007, 21608, 21614, 30006, and 21211 mean
When a Twilio send fails, the error code is the diagnosis. Read it before touching code.
The codes
- 30007, message filtered. The carrier or Twilio filtered the content. On US long codes this almost always means missing or unapproved A2P 10DLC campaign registration, or the number is not linked to the campaign. Check registration status first, code second.
- 21608, unverified number on a trial account. The recipient is not a verified number. Either verify the number in the console or upgrade the account. Not a code bug.
- 21614, not a valid mobile number. The To number is not a mobile-capable number. Run it through Lookup; you probably have a landline or a malformed number.
- 30006, landline or unreachable. The destination cannot receive SMS. Filter landlines with Lookup line type intelligence before sending.
- 21211, invalid To phone number. The number fails basic validation. Check E.164 formatting (leading +, country code, no spaces or dashes in the API value).
Procedure
- Log the full error: code, message, and the MessageSid if one was created.
- Match the code above before changing anything. Most Twilio send failures are account, registration, or data problems, not code problems.
- Fix at the right layer: registration issues in the console, number issues with Lookup, formatting issues at collection time.
- After fixing, re-test with the smallest possible send (one verified number) before re-running the batch.
Keep this skill next to your send code. When an agent sees 30007 at 2am, the answer should be one lookup away, not a debugging session.