{"record":{"id":"d5ed99d5fd218637","repo":"AtsushiSakai/PythonRobotics","slug":"unknown-status","errorCode":null,"errorMessage":"Unknown status","messagePattern":"Unknown status","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"MissionPlanning/BehaviorTree/behavior_tree.py","lineNumber":129,"sourceCode":"        self.current_child_index = 0\n\n    def tick(self) -> Status:\n        self.not_set_children_raise_error()\n\n        if self.current_child_index >= len(self.children):\n            self.reset_children()\n            return Status.SUCCESS\n        status = self.children[self.current_child_index].tick_and_set_status()\n        if status == Status.FAILURE:\n            self.reset_children()\n            return Status.FAILURE\n        elif status == Status.SUCCESS:\n            self.current_child_index += 1\n            return Status.RUNNING\n        elif status == Status.RUNNING:\n            return Status.RUNNING\n        else:\n            raise ValueError(\"Unknown status\")\n\n\nclass SelectorNode(ControlNode):\n    \"\"\"\n    Executes child nodes in sequence until one succeeds or all fail.\n\n    Returns:\n        - Returns SUCCESS if any child returns SUCCESS\n        - Returns FAILURE when all children have failed\n        - Returns RUNNING when a child is still running or when moving to the next child\n\n    Examples:\n        .. code-block:: xml\n\n            <Selector>\n                <Action1 />\n                <Action2 />\n            </Selector>","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/AtsushiSakai/PythonRobotics/blob/1fe4fb980f6a12fe21c3c33d2b4da97a52c9154d/MissionPlanning/BehaviorTree/behavior_tree.py#L111-L147","documentation":"SequenceNode.tick raises this when a child returns a Status value outside SUCCESS/FAILURE/RUNNING. The final else branch guards against corrupted or custom statuses, indicating a child node misbehaving.","triggerScenarios":"A child node's tick returns None (forgot a return statement), an int, or a custom status not in the Status enum, and the sequence node propagates ticks to it.","commonSituations":"Writing a custom action node whose tick forgets to return, or returns a raw string instead of Status.SUCCESS.","solutions":["Make every custom tick method return one of Status.SUCCESS, Status.FAILURE, Status.RUNNING.","Check the child returning the unexpected value; log its return type before it reaches the sequence.","Use tick_and_set_status so the node's stored status reveals the offending node."],"exampleFix":"// before\nclass Go(ActionNode):\n    def tick(self):\n        do_work()  # returns None\n\n// after\nclass Go(ActionNode):\n    def tick(self):\n        do_work()\n        return Status.RUNNING","handlingStrategy":"validation","validationCode":null,"typeGuard":"from MissionPlanning.BehaviorTree.behavior_tree import Status\n\ndef valid_status(s) -> bool:\n    return isinstance(s, Status)","tryCatchPattern":"try:\n    seq.tick_and_set_status()\nexcept ValueError as e:\n    if 'Unknown status' in str(e):\n        log_child_statuses(seq)  # inspect children to find the bad node\n    raise","preventionTips":["Every tick() must end in an explicit return of a Status enum member.","Unit-test each custom node's tick return value for all code paths."],"tags":["behavior-tree","enum-validation","sequence-node"],"backgroundTag":"invalid-enum-status-value","analyzedSha":"1fe4fb980f6a12fe21c3c33d2b4da97a52c9154d","analyzedAt":"2026-08-28T13:23:33.733Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}