Data problem
Twilio::REST::RestError
[HTTP 400] 21211 : Unable to create record Invalid 'To' Phone Number: +1000000XXXX https://www.twilio.com/docs/errors/21211
In one line
Twilio rejects the welcome text because the member's phone number (shown as +1000000XXXX) is not a valid number, and nothing checks the number before sending.
Checked against the code
What happened
- SendPortalWelcomeTextJob builds an E.164 number and calls Twilio::Sms.send_message.
- Twilio returned 400 / 21211: the 'To' number is invalid.
- The only check is a digits-present test in allowed_phone_number?, so a fake or placeholder number reaches Twilio.
- 264 events over 55 days points to a steady trickle of bad numbers, not a deploy problem.
What to do next
- Code fix In app/jobs/send_portal_welcome_text_job.rb, rescue Twilio::REST::RestError in perform. If e.code == 21211, log a warning and return. Re-raise any other code.
- Check Ask support or data owners whether placeholder numbers like +1000000XXXX are being entered on purpose in portal invites. If they are, fix the data entry.
Queries are shown, never run. Check them before using them on production.
Ask a follow-up
Continues the same session, so it still remembers the error and the code it read.
Analysed 1 h ago · claude-sonnet-5-5 · $0.05