I'm using the following command (Windows machine) with the MongoDB shell version: 3.0.7:

mongod --config "G:\NodeApps\mongod.cfg" --install

Contents of mongod.cfg file are given below:

    destination: file

Getting the below error:

Error parsing YAML config file: yaml-cpp: error at line 4, column 8: illegal map value
try 'mongod --help' for more information

Similar questions doesn't have the solutions for this.

What I've already tried:

  1. I'm using spaces (not tabs)
  2. I'tried by saving the file in ASCII format, as It was mentioned in one of the posts that Mongod config file shouldn't be saved in non-ACSII format. Not even in UTF-8.

Please help me with this.

4 Answers 4


The error messages indicate the specific line and column where the YAML parser is having an issue with your configuration file, but if you're not familiar with the format it can be difficult to work out what is expected.

Two sets of changes are required to make your config valid YAML:

  1. Add a "space" between the systemLog.path and storage.dbPath keys and their values

    YAML requires a space between key/value pairs, so reports: "error at line 4, column 8: illegal map value".

  2. Remove the double quotes from your path values

    YAML interprets backslashes inside quoted strings as introducing an escape character, so reports: "error at line 3, column 16: unknown escape character". As an alternative, you could also leave the path quoted but either escape the backslashes (\\) or use forward slashes.

The following config should work (assuming "G:\NodeApps\data\" has the correct directory and file permissions):

    destination: file
    path: G:\NodeApps\data\log
    dbPath: G:\NodeApps\data

There are several online testers for YAML syntax that can be useful to troubleshoot problems (eg: YAML Lint).


yaml do NOT accept tab, you must use space instead of tab

    destination: file
    path: c:\data\log\mongod.log
    dbPath: c:\data\db
     authorization: enabled
    port: 27017

above is my mongod.cfg file,
for example between security: and authorization, must be space, tab is invalid will give you the error above on title.

you should alway validate your config file at

validate yaml

  1. The "NodeApps, Data, log in G" drive must exist.
  2. Space must exist between "path:G:"
  3. All line must be one space distance.


    destination: file



    dbPath: G:/NodeApps/data


"\" should be replaced with double slash ("\") when in windows


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.