Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
All errors
CLI · sf

ENOENT: no such file or directory

The Salesforce CLI couldn't find a file or directory you referenced. Almost always a working-directory mismatch — the CLI is running in `/some/path` but the file path you passed is relative to where you *thought* you were.

Also seen asENOENT·no such file or directory·ENOENT: no such file or directory·sf cli ENOENT

ENOENT is the underlying Node.js filesystem error for "I asked the OS to open this path and the OS said no such thing exists." The Salesforce CLI surfaces it directly because Node sees it directly.

The two flavours

1. Wrong relative path

cd /Users/me/projects/myorg
sf data import tree --files Account.json

If Account.json doesn't exist in the current directory, you get ENOENT. The CLI doesn't search PATH or any project root — relative paths are relative to the shell's cwd.

Fix: use an absolute path, or cd to the directory first.

sf data import tree --files /Users/me/projects/myorg/data/Account.json

2. Path with a typo

Acount.json (missing 'c') is a common one. So is accounts.json vs Account.json (filesystem case-sensitivity matters on macOS/Linux).

Fix: copy the actual filename from ls, don't type it from memory.

Common CLI commands and the file they expect

CommandFile / dir
sf data import tree --files X.jsonA path to a JSON file with the tree-import shape
sf project deploy start --source-dir XA directory containing source-format metadata
sf project deploy start --metadata-dir XA directory containing MDAPI-format metadata
sf data tree export --output-dir XA directory that must exist (or use --mkdir)
sf org login jwt --jwt-key-file server.keyA path to the private key file

For each, the path is interpreted relative to the shell's current directory. If you're scripting in CI, anchor on the workspace root:

cd $WORKSPACE
sf project deploy start --source-dir force-app/main/default

Or use absolute paths derived from a known anchor.

When ENOENT names a file you don't recognise

Two specific cases:

~/.sf/config.json: ENOENT

The CLI's per-user config doesn't exist yet. Run sf config set target-org=alias once (or any other config command) to create it. Or just ignore it — the CLI works without the file.

A .forceignore issue

If sf project deploy start reports ENOENT on a metadata file you can see in your project, but the file is in .forceignore, the CLI may have miscalculated. Try --ignore-conflicts or temporarily comment out the .forceignore line.

A subtler version: relative paths in npm scripts

"scripts": {
  "deploy:dev": "sf project deploy start --source-dir force-app"
}

Run as npm run deploy:dev. npm runs the script from package.json's directory — so force-app is relative to that. If your package.json is at the repo root and force-app is also at the root, fine. If they're at different levels, ENOENT.

Related dictionary terms