ros2 build_error ai_generated true

xacro: error: XML parsing error: not well-formed (invalid token)

ID: ros2/urdf-xacro-parse-error

Also available as: JSON · Markdown
90%Fix Rate
88%Confidence
3Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2 active

Root Cause

XACRO/URDF file has XML syntax errors or undefined xacro macros/properties.

generic

Workarounds

  1. 92% success Run xacro standalone to get a clear error with line numbers
    xacro my_robot.urdf.xacro > /dev/null
  2. 88% success Check all xacro:property and xacro:macro definitions are included
    Verify all <xacro:include filename='...' /> paths are correct
  3. 85% success Use check_urdf to validate the generated URDF
    xacro my_robot.urdf.xacro | check_urdf /dev/stdin

Dead Ends

Common approaches that don't work:

  1. Edit the URDF file that xacro generates instead of the .xacro source 90% fail

    Generated URDF is overwritten on each build; edits are lost

  2. Ignore xacro and write raw URDF for complex robots 80% fail

    Raw URDF is unmaintainable at scale; loses parameterization, macros, and math expressions

Error Chain

Leads to: