DEBUGGING PATTERN
Store the result once
Call the action once, save its result, log the result with context, and branch from that value. Avoid calling the same state-changing method repeatedly inside one expression.
RETURN CODE REFERENCE
Save and inspect the return value of every important game action. A return code identifies the first failure branch; it does not replace checking the object, target, range, resources, cooldown, and next-tick state.
| Constant | Value | Practical meaning |
|---|---|---|
OK | 0 | The command was accepted. The visible result may still appear on a later tick. |
ERR_NOT_OWNER | -1 | The object is not controlled by you, or the method requires ownership. |
ERR_NO_PATH | -2 | No route or path could be found under the current movement options. |
ERR_NAME_EXISTS | -3 | A requested name is already in use, commonly when spawning a Creep. |
ERR_BUSY | -4 | The object is already performing an incompatible action, such as a busy Spawn. |
ERR_NOT_FOUND | -5 | The requested object, resource, reaction, or state was not found. |
ERR_NOT_ENOUGH_ENERGY | -6 | The action lacks Energy or another required resource. |
ERR_INVALID_TARGET | -7 | The target exists but cannot be used by this method. |
ERR_FULL | -8 | The target store, structure, or capacity is already full. |
ERR_NOT_IN_RANGE | -9 | The acting object is too far from the target. Move closer and retry on a later tick. |
ERR_INVALID_ARGS | -10 | One or more arguments do not match the method contract. |
ERR_TIRED | -11 | The object is on cooldown or a Creep has fatigue. |
ERR_NO_BODYPART | -12 | The Creep lacks an active body part required for the action. |
ERR_RCL_NOT_ENOUGH | -14 | The room Controller level does not permit the requested structure or action. |
ERR_GCL_NOT_ENOUGH | -15 | The account does not have enough control level for the requested claim or expansion. |
DEBUGGING PATTERN
Call the action once, save its result, log the result with context, and branch from that value. Avoid calling the same state-changing method repeatedly inside one expression.
NEXT STEP
When several systems fail together, use a room snapshot to inspect workforce, Energy, Controller pressure, construction, and CPU.
Open room diagnostics →