phacility/phabricator · warning · PhutilArgumentUsageException
Path "%s" does not exist, or is not a directory.
Error message
Path "%s" does not exist, or is not a directory.
What it means
A PhutilArgumentUsageException from the 'i18n extract' management command (bin/i18n extract). Each path argument (defaulting to the current working directory) is resolved with Filesystem::resolvePath(); if the result does not exist or is not a directory, the command refuses to run. This is a command-line argument validation error, not a runtime failure.
Source
Thrown at src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php:40
'help' => pht('Drop caches before extracting strings. Slow!'),
),
));
}
public function execute(PhutilArgumentParser $args) {
$console = PhutilConsole::getConsole();
$paths = $args->getArg('paths');
if (!$paths) {
$paths = array(getcwd());
}
$targets = array();
foreach ($paths as $path) {
$root = Filesystem::resolvePath($path);
if (!Filesystem::pathExists($root) || !is_dir($root)) {
throw new PhutilArgumentUsageException(
pht(
'Path "%s" does not exist, or is not a directory.',
$path));
}
$libraries = id(new FileFinder($path))
->withPath('*/__phutil_library_init__.php')
->find();
if (!$libraries) {
throw new PhutilArgumentUsageException(
pht(
'Path "%s" contains no libphutil libraries.',
$path));
}
foreach ($libraries as $library) {
$targets[] = Filesystem::resolvePath(dirname($path.'/'.$library)).'/';
}View on GitHub (pinned to 5720a38cfe)
Solutions
- Verify the path exists with ls before running the command
- Pass an absolute path to the intended library root, e.g. bin/i18n extract /srv/phabricator/src
- If omitting the path, make sure your current working directory still exists and is the phabricator checkout
Example fix
# before $ bin/i18n extract releative/src # after $ bin/i18n extract /path/to/phabricator/src
Defensive patterns
Strategy: validation
Validate before calling
// Before invoking the i18n extract workflow, verify each path.
foreach ($paths as $path) {
$root = Filesystem::resolvePath($path);
if (!Filesystem::pathExists($root) || !is_dir($root)) {
fwrite(STDERR, "Invalid path: {$path}\n");
exit(1);
}
} Type guard
function isExtractableDirectory($path) {
$root = Filesystem::resolvePath($path);
return Filesystem::pathExists($root) && is_dir($root);
} Try / catch
try { $workflow->execute($args); } catch (PhutilArgumentUsageException $ex) { fwrite(STDERR, $ex->getMessage()."\n"); exit(1); } // usage errors are exit-early, never retry Prevention
- Pass absolute paths to bin/i18n extract in scripts and CI
- Prefer omitting the path (defaults to cwd) only when the script cds into the checkout first
When it happens
Trigger: Running bin/i18n extract from a deleted directory (cwd no longer exists so the default path fails); passing a file instead of a directory; passing a path with a typo.
Common situations: Running extraction scripts from a shell whose working directory was removed; CI jobs passing a checkout-relative path that is wrong when the script cd's elsewhere; copy-paste of a path from another machine.
Related errors
- Path "%s" contains no libphutil libraries.
- Specify a device with --device.
- Specify a private key with --private-key.
- Specify a public key to trust with --id.
- Specify a commit and a revision to attach it to.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/0446e616eefc3f06.
Report an issue: GitHub.