FG
๐Ÿ”Œ APIs & SDKsTwilio

Unexpected token U in JSON

Freshalmost 6 years ago
Mar 14, 20260 views
Confidence Score84%
84%

Problem

Issue Summary It throws an unhandled exception. Code Snippet [code block] Exception/Log [code block] Technical details: twilio-node version: 3.43.0 node version: 12.10.0

Error Output

Error: Unexpected token U in JSON at position 4

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Moderate Confidence Fix
84% confidence100% success rate2 verificationsLast verified Mar 14, 2026

Solution: Unexpected token U in JSON

Low Risk

@childish-sambino I debugged Twilio, and figured out the real error is `451 Unavailable For Legal Reasons`. What's that? I'm sending SMS to a number from Iran (+98xxxxxxxxxx), and I also send the SMS from the number I got from Twilio (+125xxxxxxxx). Btw, I tried a couple of ways to catch the real error outside of Twilio, but I failed. I'm sure something is not right in your codes because it tries

84

Trust Score

2 verifications

100% success
  1. 1

    @childish-sambino I debugged Twilio, and figured out the real error is `451 Unav

    @childish-sambino I debugged Twilio, and figured out the real error is `451 Unavailable For Legal Reasons`. What's that? I'm sending SMS to a number from Iran (+98xxxxxxxxxx), and I also send the SMS from the number I got from Twilio (+125xxxxxxxx).

  2. 2

    Btw, I tried a couple of ways to catch the real error outside of Twilio, but I f

    Btw, I tried a couple of ways to catch the real error outside of Twilio, but I failed. I'm sure something is not right in your codes because it tries to convert the response to JSON while an exception has thrown.

Validation

Resolved in twilio/twilio-node GitHub issue #570. Community reactions: 1 upvotes.

Verification Summary

Worked: 2
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

twiliosmsapitype:-support