AtsushiSakai/PythonRobotics · error · ValueError
Child is not set
Error message
Child is not set
What it means
Raised by DecoratorNode.not_set_child_raise_error, called from tick. Decorators (inverter, retry, etc.) wrap exactly one child; ticking one whose child was never assigned is rejected.
Source
Thrown at MissionPlanning/BehaviorTree/behavior_tree.py:305
return Status.SUCCESS
class DecoratorNode(Node):
"""
Base class for all decorator nodes in a behavior tree.
Decorator nodes modify the behavior of their child node.
They must have a single child and can alter the status of the child node.
"""
def __init__(self, name):
super().__init__(name)
self.type = NodeType.DECORATOR_NODE
self.child = None
def not_set_child_raise_error(self):
if self.child is None:
raise ValueError("Child is not set")
def reset_children(self):
self.child.reset()
class InverterNode(DecoratorNode):
"""
Inverter node that inverts the status of its child node.
Returns:
- Returns SUCCESS if the child returns FAILURE
- Returns FAILURE if the child returns SUCCESS
- Returns RUNNING if the child returns RUNNING
Examples:
.. code-block:: xml
<Inverter>View on GitHub (pinned to 1fe4fb980f)
Solutions
- Set the decorator's child (root.child = inner_node) before ticking.
- When loading from XML, give the decorator tag exactly one child element.
- Tree-validate after construction: assert decorator.child is not None.
Example fix
// before
inv = InverterNode('inv')
tree.tick() # child never set
// after
inv = InverterNode('inv')
inv.child = my_action
tree.tick() Defensive patterns
Strategy: validation
Validate before calling
assert decorator.child is not None, f'{decorator.name} has no child' Type guard
def has_child(node) -> bool:
return getattr(node, 'child', None) is not None Prevention
- When building trees programmatically, set decorator.child immediately after construction.
- Validate the whole tree recursively before the first tick.
When it happens
Trigger: Creating an InverterNode (or other decorator), not setting .child (e.g. not calling set_child / not configuring via the XML builder), and ticking the tree.
Common situations: Programmatically building a tree and forgetting to attach the wrapped node, or XML where the decorator tag is empty.
Related errors
- Children are not set
- {root.name} Control node must have children
- {root.name} Decorator node must have exactly one child
- Node is not implemented
- Unknown status
AI-assisted analysis of AtsushiSakai/PythonRobotics@1fe4fb980f (2026-08-28).
Data as JSON: /api/errors/0709ff3a1a77a14d.
Report an issue: GitHub.