Nexus

py-algorand-sdk WrongKeyLengthError: "key length must be 58"

Short answer: An address string was not 58 characters. It is raised when the transaction is encoded or signed, not when you construct it.

The exact message

WrongKeyLengthError: key length must be 58

Source: captured locally with py-algorand-sdk 2.12.0 on 2026-12-03.

Why it happens

Captured with PaymentTxn(sender, sp, "NOTANADDRESS", 1): construction succeeded, and .sign(sk) raised the error. Building the transaction alone did not validate the receiver.

How to fix it

Wording can change between SDK versions. All Python SDK errors · errors.json · JavaScript SDK errors · API errors · node errors