vercel/turborepo · warning
Directory "${opts.directory}" does not exist, using current
Error message
Directory "${opts.directory}" does not exist, using current directory What it means
turbo-ignore resolves its --directory option and, when that path does not exist on disk, warns and falls back to process.cwd() for the affected check. The check therefore runs against the current working directory rather than the intended workspace, which can produce a wrong affected/not-affected answer — the more dangerous consequence of the fallback.
Source
Thrown at packages/turbo-ignore/src/ignore.ts:71
warn(
`\u001B[33m"turbo-ignore" is deprecated. Use "turbo query affected" instead.\u001B[39m`
);
warn(
`\u001B[33mLearn more: https://turborepo.dev/docs/reference/query#migrating-from-turbo-ignore\u001B[39m\n`
);
}
info(
`Using Turborepo to determine if this project is affected by the commit...\n`
);
// set default directory
if (opts.directory) {
const directory = path.resolve(opts.directory);
if (existsSync(directory)) {
inputs.directory = directory;
} else {
warn(
`Directory "${opts.directory}" does not exist, using current directory`
);
inputs.directory = process.cwd();
}
} else {
inputs.directory = process.cwd();
}
// check for TURBO_FORCE and bail early if it's set
if (process.env.TURBO_FORCE === "true") {
info("`TURBO_FORCE` detected");
return continueBuild();
}
// find the monorepo root
const root = getTurboRoot(inputs.directory);
if (!root) {
error("Monorepo root not found. turbo-ignore inferencing failed");View on GitHub (pinned to f9245100cf)
Solutions
- Pass the correct existing path (absolute, or valid relative to the invocation cwd)
- Verify the path exists in the CI step before calling turbo-ignore (`test -d "$DIR"`)
- Remove stale matrix entries for renamed/deleted packages
Example fix
# before turbo-ignore --directory=apps/weeb # typo # after turbo-ignore --directory=apps/web
Defensive patterns
Strategy: validation
Validate before calling
# Validate the target directory before turbo-ignore silently falls back to cwd
dir="${PACKAGE_DIR:?unset}"
[ -d "$dir" ] || { echo "$dir does not exist"; exit 1; }
turbo-ignore --directory="$dir" Prevention
- Resolve --directory against a known root (e.g. "$GITHUB_WORKSPACE/apps/web") instead of assuming the cwd
- Purge CI matrix entries when packages are renamed or removed
- Treat the cwd fallback as dangerous: the affected answer may silently apply to the wrong package
When it happens
Trigger: Passing `--directory=<dir>` where the resolved path does not exist: a typo, a stale package path after a rename/move, or CI running from an unexpected working directory while supplying a relative path.
Common situations: Matrix CI jobs constructing --directory dynamically for packages that were renamed or deleted; scripts assuming a different cwd than the one the step actually runs in.
Related errors
- UNKNOWN_ERROR
- Directory path contains potentially unsafe characters: ${dir
- plop_no_config
- package_manager-could_not_be_found
- joined path is absolute and valid utf8: {err:?}
AI-assisted analysis of vercel/turborepo@f9245100cf (2026-08-17).
Data as JSON: /api/errors/980ad9fe735a418f.
Report an issue: GitHub.