ERROR bag unindexed: 2021-6-23-0103all.bag. Run rosbag reindex.

1. Problem
if you want to run a. Bag file that hasn’t been used for a long time, run the command: rosbag info XXX. Bag , and find an error, as follows:

ERROR bag unindexed: 2021-6-23-0103all.bag.  Run rosbag reindex.

If you want to play it by force: rosbag play XXX. Bag , you can’t either. The error is as follows:

 [ INFO] [1624972506.447439941]: Opening 2021-6-23-0103all.bag
[FATAL] [1624972506.448068825]: Error reading from file: wanted 4 bytes, read 0 bytes

2. Solution
according to the error prompt, enter the command:

rosbag reindex xxx.bag

Two. Bag files will be generated, as follows:

in the picture, xx.orig.bag is the first package, and xxx.bag is the package after reindex.
finally, enter the command: rosbag info XXX. Bag to output normally, as follows:


Read More: