Twilio · sdk · fg-0165

Twilio client throws 'accountSid must start with AC' when created with an API key

If you see Error: accountSid must start with AC, the cause and the fix for Twilio are below, last verified 2026-10-15.

Verified Oct 2026trust 50/100
Symptom
Error: accountSid must start with ACThe given SID indicates an API Key which requires the accountSid to be passed as an additional option
Cause
The helper treats its first argument as both the username and the account SID unless an accountSid option is given. An API key SID starts with SK, so validation fails.
Fix
Pass the key SID and secret as the first two arguments and the real account SID in the options object.
Apply
const client = twilio(process.env.TWILIO_API_KEY_SID, process.env.TWILIO_API_KEY_SECRET, { accountSid: process.env.TWILIO_ACCOUNT_SID });
Affected
twilio-node 3.x through 6.2.0, current in October 2026
Sources

Last verified 2026-10-15 · Confirmed by 0 builders

Related traps

Have your agent know this before it fails

$ /plugin marketplace add getfootgun/footgun
$ /plugin install footgun@footgun