# rclcpp::exceptions::RCLError: failed to publish parameter event: cannot call publish while in a callback group

- **ID:** `ros2/rclcpp-parameter-event-callback-deadlock`
- **Domain:** ros2
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

A parameter event callback tries to publish a message on the same topic that triggered the callback, causing a deadlock in the callback group's executor.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| ros2-humble | active | — | — |
| ros2-iron | active | — | — |
| ros2-rolling | active | — | — |

## Workarounds

1. **Use a separate callback group for the parameter event subscriber: auto param_event_group = create_callback_group(rclcpp::CallbackGroupType::Reentrant); auto sub = create_subscription<rcl_interfaces::msg::ParameterEvent>('/parameter_events', 10, callback, param_event_group);** (90% success)
   ```
   Use a separate callback group for the parameter event subscriber: auto param_event_group = create_callback_group(rclcpp::CallbackGroupType::Reentrant); auto sub = create_subscription<rcl_interfaces::msg::ParameterEvent>('/parameter_events', 10, callback, param_event_group);
   ```
2. **Publish the parameter event asynchronously using a timer: in the callback, schedule a timer to publish the message after the callback returns.** (85% success)
   ```
   Publish the parameter event asynchronously using a timer: in the callback, schedule a timer to publish the message after the callback returns.
   ```

## Dead Ends

- **** — MutuallyExclusive groups still deadlock if the same callback tries to publish to the triggering topic. (90% fail)
- **** — The event callback is still in the same callback group; publishing from another node doesn't resolve the deadlock. (70% fail)
