prefixkit Ask an engineerAsk Support RU

Error reference · WireGuard

WireGuard: Key is not the correct length or format: `abc…`

Key is not the correct length or format: `abc…`

What it means

A PrivateKey, PublicKey or PresharedKey in the config is not a valid 32-byte base64 key.

Why it happens

  • The key was cut when copying (it is 44 characters ending in =).
  • Quotes, spaces or a line break got into the value.
  • A public key pasted where a private key is expected.

How to fix it

  1. Generate keys again: wg genkey | tee priv | wg pubkey > pub, and paste whole lines.
  2. Remove quotes and spaces around the value.
  3. The generator on prefixkit makes matching keys in the browser.

Useful tools

WireGuard config generator

Other WireGuard errors

Idea?