Skip to content
86% off$349 $48.86code BF2026

Guides

CyberChef JWT Sign: "Right-hand side of instanceof" Fix

CyberChef JWT Sign fails with TypeError: Right-hand side of 'instanceof' is not an object. Why it happens and three ways to sign a JWT locally.

TroubleshootingUpdated 5 min read

On this page

You pasted a secret or a PEM key into CyberChef's JWT Sign operation and got this:

text
Have you entered the key correctly? The key should be either the secret for HMAC algorithms or the PEM-encoded private key for RSA and ECDSA. TypeError: Right-hand side of 'instanceof' is not an object

Why CyberChef JWT Sign shows this error

The first two sentences are CyberChef's generic key hint. It appears for any failure in the operation, so it points at your key even when the key is fine. The part that matters is the TypeError at the end.

CyberChef issue #2434 (reported May 2026) says JWT Sign has been broken since v10.23.0 and fails the same way on 11.0.0. According to that report, the maintainers said the jsonwebtoken 9.x library does not work in the browser. They also said that going back to an older version carries a known CVE. We know of no workaround inside CyberChef. We have not confirmed a fixed release, so check CyberChef's issue tracker for the current state.

A quick test tells you whether you are hitting this bug. Sign with HS256 and a short plain-text secret such as test-secret. If it fails with the same TypeError, the problem is the operation, not your key.

SymptomLikely causeWhat to do
Same TypeError, even with HS256 and a plain secretThe known JWT Sign bug in v10.23.0 and laterSign outside CyberChef (steps below)
TypeError only with a PEM keyProbably the same bug; not confirmed separatelyRun the HS256 test first, then sign elsewhere
CyberChef page fails to loadA separate load problem (see the section near the end)Follow the CyberChef issue threads

Fix 1: sign the JWT in Bytepliers

The JWT Decoder tool in Bytepliers has an Encode tab that signs tokens on your Mac. It supports HS256/384/512, RS256/384/512, PS256/384/512, ES256/384/512 and EdDSA (Ed25519). The tools make no network calls.

  1. Open JWT Decoder from the Inspect group in the sidebar, or press ⌘4 (Command-4).
  2. Click the Encode tab.
  3. Edit the Header and Payload JSON. They start with an HS256 header and a sample payload.
  4. Choose an Algorithm. If it differs from the header's alg value, update the header to match.
  5. Optional: open the Claims menu and choose Set iat to Now or Set exp to 1 Hour from Now.
  6. Enter the key. For HMAC algorithms use Secret. For the others use Private key: a PEM (PRIVATE KEY, RSA PRIVATE KEY or EC PRIVATE KEY) or a JWK.
  7. Copy the Token output with ⇧⌘C (Shift-Command-C).
  8. Click Verify in Decoder to check the result.

In the Decoder, the Signature pane should hold the same secret, or the matching public key. A correct token shows "Signature verified". "Invalid signature" means the key differs from the one you signed with. For secrets, the encoding (UTF-8, Base64 or Hex) must also match.

Match the key type to the algorithm

Algorithm familyKey you enter
HS256, HS384, HS512A shared secret
RS256/384/512 and PS256/384/512An RSA private key
ES256, ES384, ES512An EC private key
EdDSAAn Ed25519 private key

The IANA registry for JOSE lists these alg values and where each is defined, if you need to confirm one: IANA JOSE registry.

Limits to know:

  • Signing lives in the Encode tab only. The bytepliers command-line tool and the Shortcuts actions decode JWTs (payload and header), so they cannot replace a signing step in a script.
  • JWT inputs are not recorded in history unless you turn on Also record inputs that look like secrets.
  • Bytepliers needs macOS 14 or later.

Fix 2: sign an HS256 token in Terminal

This works only for HS256 (a shared secret). It uses openssl, which ships with macOS, so there is nothing to install.

bash
secret='test-secret'
header=$(printf '%s' '{"alg":"HS256","typ":"JWT"}' | openssl base64 -A | tr '+/' '-_' | tr -d '=')
payload=$(printf '%s' '{"sub":"1234","name":"Test"}' | openssl base64 -A | tr '+/' '-_' | tr -d '=')
sig=$(printf '%s' "$header.$payload" | openssl dgst -sha256 -hmac "$secret" -binary | openssl base64 -A | tr '+/' '-_' | tr -d '=')
echo "$header.$payload.$sig"

It Base64URL-encodes the header and payload, signs header.payload with HMAC-SHA256, and prints the three parts joined by dots. It changes no settings, so there is nothing to undo.

Fix 3: a web debugger for test tokens

jwt.io is Auth0's free web debugger that can decode, verify and generate JWTs. Auth0 staff have said that decoding and verification happen locally in the browser (community post, about March 2026), but the redesigned site no longer says so on the page. It needs a browser and a page load, and it covers JWTs only. Use it for test tokens, not production keys.

Which option to pick

NeedPick
RS, PS, ES or EdDSA signing with a real private key, offlineBytepliers
One quick HS256 test tokenTerminal
No install, throwaway tokenjwt.io
Stay in CyberChefWait for a fix; none confirmed as of November 2026

Checklist before you try again

  • The alg in the header matches the algorithm you selected.
  • The key type fits the algorithm (secret, RSA, EC or Ed25519).
  • The PEM includes its -----BEGIN ...----- and -----END ...----- lines.
  • For secrets, the encoding (UTF-8, Base64 or Hex) is the same when you verify.
  • The payload is valid JSON with double quotes.

If CyberChef fails to load instead

Two other failures appear in CyberChef's issue tracker. They are separate from the instanceof error:

  • "Uncaught SyntaxError: Unexpected token ']'" (reported February 2026, Chrome 146 on a Mac)
  • "Error: Cannot find module './config/modules/OpModules.mjs'"

We have no confirmed fix for either, so follow those threads.

If nothing works

If Bytepliers returns "Invalid signature" or "Key not usable", the key and algorithm probably do not match. If the TypeError still appears in CyberChef, add your details to issue #2434 rather than opening a new one. For Bytepliers problems, use the support page.

Include the CyberChef version (v10.23.0 or 11.0.0, for example), the browser, the exact error text, and whether HS256 with a plain secret also fails. A message you can adapt:

text
CyberChef JWT Sign fails with: TypeError: Right-hand side of 'instanceof' is not an object
Version: 11.0.0 (also seen on v10.23.0)
Browser: Chrome on macOS
Steps: JWT Sign, algorithm HS256, secret "test-secret", payload {"sub":"1234"}
Result: same error with a plain secret, so it does not look like a key problem.

Common questions

Is my private key wrong if I see this error?

Probably not. The hint text always mentions the key, but the TypeError after it comes from the library failing to load in the browser. Try HS256 with a plain secret to confirm.

Can I downgrade CyberChef to get JWT Sign back?

The maintainers reportedly said an older jsonwebtoken version has a known CVE, so downgrading is not a recommended fix. We have not tested older CyberChef releases.

Can Bytepliers verify a token I signed elsewhere?

Yes. The Decode tab's Signature pane takes a secret or a public key (PEM, bare Base64 DER, JWK or JWK Set), and shows "Signature verified" or "Invalid signature". For reading tokens, see how to decode a JWT on Mac.

Signing offline in Bytepliers

If you sign tokens regularly, Bytepliers covers the algorithms CyberChef currently fails on, with no network calls. It is part of MacSuite ($349 one-time, as of November 2026), with a 7-day free trial.

Every app.
One purchase.