Cryonel

"jwt malformed" / "Not enough segments" Error, Explained

This error fires before a JWT library even looks at the signature or claims — it means the string you handed it isn't shaped like a JWT at all.

What triggers it

A JWT is exactly three base64url segments joined by dots: header.payload.signature. Libraries typically split on . and check the count before doing anything else. You'll see this error (worded differently depending on the library — jwt malformed, Not enough or too many segments, invalid token specified) when:

How to check it quickly

Paste the raw string into the JWT Decoder. If it's genuinely malformed, you'll see exactly that — a segment-count or base64 decode failure — before any signature check runs, which tells you the problem is in how the token was captured or stored, not in your verification logic.

Related Tools