Quick answer
The earliest Code: Terraform errors are usually small and fixable: wrong component names, missing indentation after if/else or while, using a non-string transmit key, reading recipe data before analyze() has produced it, or blaming the code when the machine actually lost power. If you debug in that order, you usually find the problem fast.
Quick triage order
- Check that the machine is powered and you are editing the intended script slot.
- Check component names and target strings exactly.
- Check indentation under
if,else, andwhile. - Check current machine state before reading deeper properties such as
self.input.recipe. - Only then question the math or contract algorithm.
Common early errors
| Error pattern | Usually means | First fix |
|---|---|---|
expected indent at start of block | A child line under if, else, or while is not indented | Fix block indentation |
contract is not defined | A variable name was used before assignment | Create/assign it before use |
expected string for key | The first transmit() argument is not a string | Pass a quoted key / contract ID string |
cannot access recipe on none | The lab has no analyzed specimen ready | Check self.input and analyze first |
| Valid-looking code but no progress | Power or machine state is blocking the action | Check power, cargo, and stage |
Low-friction debugging habits
- Keep intermediate values in named variables while learning the system.
- Print a temporary value or branch result when you need to prove what the code is doing.
- Split contract answer computation from transmitter delivery.
- Read state before issuing a hardware action. This is especially important in the biology loop.