d devhelper

← All errors

Data problem

Twilio::REST::RestError

[HTTP 400] 21211 : Unable to create record Invalid 'To' Phone Number: +1000000XXXX https://www.twilio.com/docs/errors/21211

SendPortalWelcomeTextJob@default88 events · 0 users first seen 55 d agolast seen 13 h ago

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

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

Enter to send · Shift+Enter for a new line
Analysed 1 h ago · claude-sonnet-5-5 · $0.05