Issue
When sending events to Amplitude via Segment, you may encounter a 400 Bad Request error with the message: "Invalid id length for user_id or device_id". This error occurs when the user_id or device_id in the event payload is shorter than the minimum length required by Amplitude. You may see this error in the Segment Console’s Delivery Overview for your Amplitude destination.
Product
Twilio Segment
Environment
Segment Console
Cause
Amplitude enforces a strict validation rule that requires all user_id and device_id values to be at least 5 characters long. If an event is sent with a user_id or device_id shorter than this minimum, Amplitude will reject the event and return a 400 Bad Request error.
Resolution
user_id or device_id values to be accepted by Amplitude, follow these steps:
- In the Segment Console, navigate to Connections > Destinations and select your Amplitude (Actions) destination.
- Open your active Mappings (for example, Log Event V2).
- Locate the Minimum ID Length settings field.
-
Override the default value to match the shortest
user_idordevice_idyou intend to send. - Save your changes.
min_id_length exception flag into the outgoing payload, instructing Amplitude to accept user IDs shorter than the default minimum.
Additional Information
For more details, see the Amplitude Actions Destination Documentation.