Nexus

TEAL compile error: "unknown opcode"

Short answer: The assembler does not know the word you used where an opcode belongs. Usually a typo, or an opcode that does not exist.

The exact message

1 error: 2: unknown opcode: foo

Source: POST /v2/teal/compile, HTTP 400, captured against a public TestNet node on 2026-12-03.

Why it happens

Captured with a program whose second line was foo. The message gives the line number (2) and prints the word it rejected.

How to fix it

Wording can change between node versions. All API errors · errors.json · transaction errors · SDK errors · costs