ESME_RINVMSGLEN in SMPP

What is ESME_RINVMSGLEN?

ESME_RINVMSGLEN (Error Code: 0x00000004) is an SMPP error that indicates an invalid message length in an SMPP request.

Possible Causes

  • The message length exceeds the allowed limit (typically 254 or 160 characters for certain encodings).
  • The message length is zero (empty message).
  • Incorrect encoding causing unexpected length calculation.
  • Corrupt or malformed PDU (Protocol Data Unit) being sent.
  • Incorrect concatenation of long messages (splitting issues).

When Does It Happen?

This error occurs when submitting an SMPP PDU (e.g., submit_sm, data_sm) where the message length parameter does not conform to the expected length constraints set by the SMSC.

Example SMPP PDU Transaction

The following is an example of an incorrect submit_sm PDU that could trigger the ESME_RINVMSGLEN error:

0000003C 00000004 00000000 00000001 
74657374 000101 35363137 38363530 
30303000 0000 0000 0000 00000000 
00000000 00

Issue: The message length field is set to zero, which results in an invalid message length error.

Another incorrect PDU where the message exceeds the allowed length:

00000100 00000004 00000000 00000002 
74657374 000101 35363137 38363530 
30303000 0000 0000 0000 00000000 
00000100 (Too long)

How to Solve It?

  • Ensure the message length is within the allowed limits (check SMSC restrictions).
  • Validate encoding (e.g., UCS2 messages take 2 bytes per character).
  • Ensure proper concatenation of long messages using sar_msg_ref_num, sar_total_segments, etc.
  • Check for empty messages before sending.
  • Verify the PDU format to ensure it is correctly structured.

If the issue persists, enable SMPP debugging on your client or SMS gateway to inspect the raw PDUs being transmitted.

More information