# [rosbag2_storage] Failed to open bag: unsupported compression format 'lz4' for storage plugin 'sqlite3'

- **ID:** `ros2/rosbag2-compression-unsupported-format`
- **Domain:** ros2
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The rosbag2 storage plugin (e.g., sqlite3) does not support the specified compression format (e.g., lz4, zstd). Supported formats depend on the plugin version and build options.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Humble | active | — | — |
| Iron | active | — | — |
| Rolling | active | — | — |

## Workarounds

1. **Check supported compression formats: ros2 bag info /path/to/bag. If unsupported, re-record the bag without compression: ros2 bag record -o my_bag --no-compression /topic1 /topic2. Then play back: ros2 bag play my_bag** (90% success)
   ```
   Check supported compression formats: ros2 bag info /path/to/bag. If unsupported, re-record the bag without compression: ros2 bag record -o my_bag --no-compression /topic1 /topic2. Then play back: ros2 bag play my_bag
   ```
2. **If you need compression, use a supported format like 'zstd'. Record with: ros2 bag record -o my_bag --compression-mode file --compression-format zstd /topic1. Ensure zstd is installed: sudo apt-get install libzstd-dev** (85% success)
   ```
   If you need compression, use a supported format like 'zstd'. Record with: ros2 bag record -o my_bag --compression-mode file --compression-format zstd /topic1. Ensure zstd is installed: sudo apt-get install libzstd-dev
   ```
3. **For custom builds, rebuild rosbag2 with the desired compression plugin: colcon build --packages-select rosbag2_compression --cmake-args -DCOMPRESSION_LZ4=ON. Then restart recording.** (75% success)
   ```
   For custom builds, rebuild rosbag2 with the desired compression plugin: colcon build --packages-select rosbag2_compression --cmake-args -DCOMPRESSION_LZ4=ON. Then restart recording.
   ```

## Dead Ends

- **** — The system library is not enough; rosbag2 must be built with lz4 support enabled at compile time. Simply having the library doesn't enable the plugin. (90% fail)
- **** — Changing the environment variable only affects recording, not playback. If the bag was recorded with lz4, playback will still fail if lz4 is unsupported. (85% fail)
