RETURN CODE REFERENCE

Screeps error codes

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.

ConstantValuePractical meaning
OK0The command was accepted. The visible result may still appear on a later tick.
ERR_NOT_OWNER-1The object is not controlled by you, or the method requires ownership.
ERR_NO_PATH-2No route or path could be found under the current movement options.
ERR_NAME_EXISTS-3A requested name is already in use, commonly when spawning a Creep.
ERR_BUSY-4The object is already performing an incompatible action, such as a busy Spawn.
ERR_NOT_FOUND-5The requested object, resource, reaction, or state was not found.
ERR_NOT_ENOUGH_ENERGY-6The action lacks Energy or another required resource.
ERR_INVALID_TARGET-7The target exists but cannot be used by this method.
ERR_FULL-8The target store, structure, or capacity is already full.
ERR_NOT_IN_RANGE-9The acting object is too far from the target. Move closer and retry on a later tick.
ERR_INVALID_ARGS-10One or more arguments do not match the method contract.
ERR_TIRED-11The object is on cooldown or a Creep has fatigue.
ERR_NO_BODYPART-12The Creep lacks an active body part required for the action.
ERR_RCL_NOT_ENOUGH-14The room Controller level does not permit the requested structure or action.
ERR_GCL_NOT_ENOUGH-15The account does not have enough control level for the requested claim or expansion.

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.

NEXT STEP

Check the full room state

When several systems fail together, use a room snapshot to inspect workforce, Energy, Controller pressure, construction, and CPU.

Open room diagnostics →