Bad YAML File Created with Map Saver (Continuation)


I have previously open this thread but it get closed due to the time limit.
In that thread all configuration file seems okay and I’m told to try again creating the map.

Now I’m creating a new map using the cartographer but the issue still exist
[map_server-1] [ERROR] [map_io]: Failed processing YAML file /home/user/ros2_ws/install/map_server/share/map_server/maps/tutlebot_area.yaml at position (-1:-1) for reason: bad file

Does anyone have the same experience?

This is my turtlebot_area.yaml file
Screenshot from 2023-06-28 11-37-43

Thank you.

Hi @AlfoChri ,

Looking at your yaml file, I don’t see any issues. The formatting is correct (since it is automatically produced).

You can check for a few things here to (maybe) fix your problem:

  1. Check if turtlebot_area.pgm and turtlebot_area.yaml are in the same folder.
  2. Check if turtlebot_area.yaml has any hidden special characters (that are probably ascii or non-ascii characters). To do this try the command cat -A ./turtlebot_area.yaml from the folder containing this file. If you find any special characters, then delete them using a text editor.

If the above two steps did not solve your problem then, as a last step, type the entire contents “as-is” into a fresh yaml file. DO NOT COPY-PASTE.
Once you have typed the entire contents into a fresh yaml file, delete the old file and rename the new file to turtlebot_area.yaml. This should hopefully work.

If all these fails, then let us know here.


Hi @girishkumar.kannan ,

Thanks for the feedback.
I have followed your guide and the error still exist unfortunately.

  1. Yes, the pgm and yaml are in the same folder.
  2. I have checked and I think there are no special characters
    Screenshot from 2023-06-28 13-32-25
  3. I tried to create new yaml file without copy-paste from the previously generated yaml file but still error

Hi @AlfoChri ,

Have you tried removing build, install and log folders and recompiling the package from scratch?

Maybe that should fix.

cd ~/ros2_ws
rm -rf ./build ./install ./log
colcon build && source install/setup.bash
ros2 launch ... (complete the command)


Thanks for the help.
Unfortunately the error still exist. Maybe it’s the package need to be reinstalled(?)

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.