# [component_container_isolated]: Failed to load component: Failed to find class with name 'my_pkg::MyComponent': No matching class found in library

- **ID:** `ros2/component-container-mismatch`
- **Domain:** ros2
- **Category:** module_error
- **Verification:** ai_generated
- **Fix Rate:** 90%

## Root Cause

The component class is either not registered with the RCLCPP_COMPONENTS_REGISTER_NODE macro, or the library was not built/linked correctly, so the container cannot instantiate it at runtime.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| ROS2 Humble | active | — | — |
| ROS2 Iron | active | — | — |
| ROS2 Jazzy | active | — | — |

## Workarounds

1. **Ensure the component source file includes the registration macro: 'RCLCPP_COMPONENTS_REGISTER_NODE(my_pkg::MyComponent)' and that the CMakeLists.txt uses 'add_library' with 'ament_target_dependencies' and 'pluginlib_export_plugin_description_file' if needed.** (95% success)
   ```
   Ensure the component source file includes the registration macro: 'RCLCPP_COMPONENTS_REGISTER_NODE(my_pkg::MyComponent)' and that the CMakeLists.txt uses 'add_library' with 'ament_target_dependencies' and 'pluginlib_export_plugin_description_file' if needed.
   ```
2. **Check the library exports: 'nm -C libmy_component.so | grep MyComponent' to see if the symbol is present. If not, rebuild with 'colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug' and check for missing dependencies.** (85% success)
   ```
   Check the library exports: 'nm -C libmy_component.so | grep MyComponent' to see if the symbol is present. If not, rebuild with 'colcon build --cmake-args -DCMAKE_BUILD_TYPE=Debug' and check for missing dependencies.
   ```
3. **Verify the component's plugin description XML file (e.g., 'my_component_plugins.xml') is correctly formatted and referenced in 'package.xml' under <export>.** (90% success)
   ```
   Verify the component's plugin description XML file (e.g., 'my_component_plugins.xml') is correctly formatted and referenced in 'package.xml' under <export>.
   ```

## Dead Ends

- **Adding the component source file to a different package's CMakeLists.txt without proper registration** — The class must be registered in the same library where it is built, using the correct macro. Moving files without registration does not help. (90% fail)
- **Manually loading the library with 'dlopen' in the container to verify it exists** — The library may exist but the class registration may still be missing. This does not fix the registration issue. (60% fail)
