Skip to content

Fix: Misleading error for unrecognized behavior ports#19

Merged
griswaldbrooks merged 1 commit intomainfrom
18029-fix-port-error-message
Apr 10, 2026
Merged

Fix: Misleading error for unrecognized behavior ports#19
griswaldbrooks merged 1 commit intomainfrom
18029-fix-port-error-message

Conversation

@griswaldbrooks
Copy link
Copy Markdown

@griswaldbrooks griswaldbrooks commented Apr 9, 2026

Summary

  • Use type_ID instead of element->Name() so the error prints the actual behavior name (e.g., ClearSnapshot) rather than the generic XML tag (e.g., Action).
  • Use element->GetLineNum() instead of att->GetLineNum() for a more accurate line number.

Fixes PickNikRobotics/moveit_pro#18029

Before:

a port with name [topic_name] is found in the XML (<Action>, line 6) but not in the providedPorts() of its registered node type.

After:

A port with name [topic_name] is found in the XML (ClearSnapshot, line 6) but not in the providedPorts() of its registered node type.

Note on line numbers

Line numbers may not match the original XML file because MoveIt Pro's objective server reformats the XML through tinyxml2::XMLPrinter before passing it to BehaviorTree.CPP (see load_objective_definitions.cpp). The line numbers reported are relative to the reformatted XML, not the original file. Fixing this offset is out of scope for this PR — the behavior name is the more important improvement for debugging.

Test plan

  • Build behaviortree_cpp in the MoveIt Pro container
  • Reproduce original bug by removing providedPorts() from ClearSnapshot and adding a topic_name port in the objective XML
  • Confirm the error now shows the correct behavior name

🤖 Generated with Claude Code

Use type_ID instead of element->Name() so the error prints the actual
behavior name (e.g. GetEpickObjectDetectionStatus) rather than the
generic XML tag (e.g. Action). Use element->GetLineNum() instead of
att->GetLineNum() for a correct line number.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@griswaldbrooks griswaldbrooks marked this pull request as ready for review April 9, 2026 22:50
@griswaldbrooks griswaldbrooks requested a review from dsobek April 9, 2026 22:50
@griswaldbrooks griswaldbrooks added this pull request to the merge queue Apr 10, 2026
Merged via the queue into main with commit 5999ba2 Apr 10, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants