Error
Error Code:
72
MongoDB Error 72: Invalid Configuration Options
Description
MongoDB Error 72, 'Invalid Options', indicates that an unrecognized, malformed, or improperly used option was provided to the MongoDB server, a command, or a client connection. This error typically arises when configuring the `mongod` process, executing administrative commands, or constructing MongoDB URI connection strings, preventing the operation from starting or completing successfully.
Error Message
Invalid Options
Known Causes
4 known causesUnrecognized Option
An option that MongoDB does not support or recognize was included in the configuration, command, or connection string.
Incorrect Syntax or Value
A valid option was provided but with incorrect syntax, a malformed value, or a value outside the expected range for that option.
Deprecated or Removed Option
An option that was valid in previous MongoDB versions has been deprecated or removed and is no longer supported in the current version.
Misplaced Option
An option intended for a different context (e.g., a server configuration option used in a client connection string) was provided.
Solutions
3 solutions available1. Review and Correct MongoDB Configuration File medium
Identify and fix syntax or option errors in your mongod.conf file.
1
Locate your MongoDB configuration file. This is typically named `mongod.conf` and can be found in `/etc/mongod.conf` on Linux, or within the MongoDB installation directory on Windows.
2
Open the configuration file in a text editor. Be cautious when editing system files; consider making a backup first.
3
Carefully review each line for syntax errors, typos, or invalid options. Common issues include incorrect indentation, missing colons, or using deprecated options. Consult the MongoDB documentation for the version you are running to verify valid options.
Example of a valid option:
storage:
dbPath: /var/lib/mongodb
Example of a potential error (typo):
storge:
dbPath: /var/lib/mongodb
4
If you've recently added or modified options, focus your review on those changes. Pay close attention to options related to networking, storage, security, and logging.
5
Save the corrected configuration file.
6
Attempt to restart the MongoDB service. The command will vary depending on your operating system and installation method.
# On systems using systemd (common on modern Linux):
sudo systemctl restart mongod
7
Check the MongoDB logs for more specific error messages if the restart fails. The log file location is usually defined in the configuration file itself (e.g., `systemLog.path`).
# Example log file path:
cat /var/log/mongodb/mongod.log
2. Verify Command-Line Options (if not using a config file) easy
Ensure any direct command-line arguments passed to `mongod` are valid.
1
If you are starting `mongod` directly from the command line without a configuration file, review the options you are passing. Error 72 often indicates an invalid option was provided.
2
Compare the options you are using with the official MongoDB command-line options documentation for your version. Ensure there are no typos or deprecated options.
# Example of starting mongod with options:
mongod --dbpath /data/db --port 27017 --bind_ip localhost
# If you incorrectly typed --bind_ip as --bind_ipz, this error would occur.
3
Remove any suspicious or unrecognized options and attempt to restart `mongod`.
3. Check for Version-Specific Configuration Options medium
Ensure configuration options are compatible with your MongoDB version.
1
Identify the exact version of MongoDB you are running. You can usually find this by checking the output of `mongod --version` or `mongo --version`.
mongod --version
2
Navigate to the official MongoDB documentation for that specific version. For example, if you are running MongoDB 5.0, search for 'MongoDB 5.0 manual'.
3
Review the configuration file options or command-line options sections. Older versions may have different option names or may have deprecated certain configurations that are still present in your file.
4
Update your `mongod.conf` file or command-line arguments to use the correct, version-appropriate options.
5
Restart the MongoDB service after making the necessary corrections.
# On systems using systemd (common on modern Linux):
sudo systemctl restart mongod