Error parsing YAML config file: yaml-cpp: error at line 5, column 9: illegal map value

 storage:
		dbPath: "/data/db"
 replication:
  		replSetName: M103
net:
  bindIp : "127.0.0.1,192.168.103.100"
  port:27000
  security: 
  	authentication: enabled
   processManagement:
   	fork:true

The error is obviously dbPath. Have I understood something wrong.

You will be using editor area of IDE
Nothing to do in shell
What issue are you facing?

1 Like

Hi @Roman_Rostock,

If the subject of this topic is accurate, the error is at line 5, column 9 (dbPath is line 2).

I expect the problem is that you have used tabs instead of spaces, which is the case if I copy the quoted example in your post.

YAML forbids tabs and parsers expect 2 or 4 spaces between key/value pairs:

Tabs have been outlawed since they are treated differently by different editors and tools. And since indentation is so critical to proper interpretation of YAML, this issue is just too tricky to even attempt.

Unfortunately YAML parser errors like “illegal map value” do not provide any helpful clues on what the expected format is, so you have to review whatever is at the indicated line and column position for error messages like this.

Regards,
Stennie

4 Likes

Hello Stennie, thanks for your answer, I solved this error, by using a yaml validator. It was the first time I heard from yaml. But now I get the error :

Failed global initialization: FileNotOpen: Failed to open "/root/workspace/data/log/mongod.log

I tried “ls /root/workspace”, and the only entry in the workspace is mongod.conf, but the given path is: data/log/mongod.log. So it seems I have to create the folders and the file. I never worked before with linux, I know mkdir, but clearly when I enter cd root, the ide in the course tells me : no such file or directory.
By the way, when I enter code I put three backticks before and three backticks after like I have read in the description, but the code looks terrible. How I do this right?
Thanks
Best Roman

Can you please post your entire configuration file? My guess is that the sytemLog.path is data/log/mongod.log which will try to put the log file in a directory that is relative to where the config file is located. I’m assuming you wanted to put the logs in /data/log which is an absolute path.

You would need to make sure that the directory that the log files are to be written to exist, and just as importantly have permissions to be read and written by the user running the mongod process. As this is for the M103 course, the steps should hopefully be explained on how to do what you need to do. It’s been a while since I took the course however.

Hello Doug, can you give me a hint, how I can copy my current code into my post? When I press edit, I have a red field on the left side and right a green field. I think it is becaue Stennie edited my post. But I cannot overwrite the fields.

From your description, it sounds like you’re trying to press the pencil icon at that top of the post which just means that a post has been edited

This is the only way that I know of to get the red/green difference view you mention.

There should also be a pencil icon at the bottom of any post you make

This would be the one you would use to edit your post.

In this case however it’s best to reply to the question with a new post with the data asked for so one is not having to find things.

And as you mentioned, you would want to use the preformatted text option by either clicking on the
image
icon in the tool bar, or at the start of a new line type in the triple backtick ``` to start a code block and then do the same to end the code block. These must be at the start of a line and be the only thing on that line as follows:

```
your code here
```

I try it currently like this:

storage:
       dbPath: "/data/db"
systemLog:
  path: "data/log/mongod.log"
  destination: "file"
replication:
        replSetName: M103
net:
     bindIp: "127.0.0.1,192.168.103.100"
     port : 27000
security:
 authorization: enabled

That is what I thought.

This means you want the log file to be located in the folder data/log in the folder where the config file is located. I assume however that you were wanting the log file to be located in /data/log. If that’s the case, you would need to put in the missing / at the beginning of the path, and then run mkdir /data/log to create the missing directory.

What I have to do before? When I try this comes:

bash: mkdir/data/log: No such file or directory

You are missing a space after mkdir.

This config file does not match the requirements of the m103 course.

It looks like it is taken from the vagrant version of the course. The IP address 192.* is certainly not valid for the IDE.

How can that be. I copied that address out of this course. And the course was offered me per mail after I ended with M001-basic. So it should be the right. Where can I check this?

They use this address in the examples. But the requirements for the lab are for 127.* only.

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