# [rosbag2_storage] 无法打开包：存储插件'sqlite3'不支持的压缩格式'lz4'

- **ID:** `ros2/rosbag2-compression-unsupported-format`
- **领域:** ros2
- **类别:** resource_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

rosbag2存储插件（如sqlite3）不支持指定的压缩格式（如lz4、zstd）。支持的格式取决于插件版本和构建选项。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Humble | active | — | — |
| Iron | active | — | — |
| Rolling | active | — | — |

## 解决方案

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
   ```
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
   ```
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.
   ```

## 无效尝试

- **** — 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% 失败率)
- **** — 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% 失败率)
