doctor (Deprecated)

Gather CLI configuration data and run diagnostic tests to discover and report potential problems in your environment.

This command is deprecated. As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style doctor command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Changed flag name: Old name --outputdir. New name: --output-dir.
  • Changed flag name: Old name --createissue. New name: --create-issue.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on January 12, 2023.

Warning

Help for doctor

When you run the doctor command without parameters, it first displays a diagnostic overview of your environment. It then writes a detailed diagnosis to a JSON file in the current directory. Use the --outputdir to specify a different directory. To run diagnostic tests on a specific plugin, use the --plugin parameter. If the plugin isn't listening to the doctor, then you get a warning.

Use the --command parameter to run a specific command in debug mode; the doctor writes both stdout and stderr to *.log files that you can provide to Salesforce Customer Support or attach to a GitHub issue.

Plugin providers can also implement their own doctor diagnostic tests by listening to the "sf-doctor" event and running plugin specific tests that are then included in the doctor diagnostics log.

Examples for doctor

Run CLI doctor diagnostics:

1sfdx doctor

Run CLI doctor diagnostics and the specified command, and write the debug output to a file:

1sfdx doctor --command "force:org:list --all"

Run CLI doctor diagnostics for a specific plugin:

1sfdx doctor --plugin @salesforce/plugin-source

Command Syntax

sfdx doctor
[--json]
[--loglevel LOGLEVEL]
[-c COMMAND]
[-p PLUGIN]
[-o OUTPUTDIR]
[-i]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-c | --command COMMAND
Optional

Command to run in debug mode ; results are written to a log file.

Type: string
-p | --plugin PLUGIN
Optional

Specific plugin on which to run diagnostics .

Type: string
-o | --outputdir OUTPUTDIR
Optional

Directory to save all created files rather than the current working directory.

Type: directory
-i | --createissue
Optional

Create a new issue on our GitHub repo and attach all diagnostic results.

Type: boolean