phacility/phabricator · error · PhutilArgumentUsageException
Failed to create directory "%s" for specified log file (with
Error message
Failed to create directory "%s" for specified log file (with index "%s"). You should manually create this directory or choose a different logfile location. %s
What it means
Thrown when Filesystem::createDirectory() fails while trying to create the parent directory of a log file path listed under 'logs' in the Aphlict config. The caught FilesystemException message is appended, so the real OS-level cause (usually permissions) appears after the template text.
Source
Thrown at src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php:214
}
$logs = idx($data, 'logs', array());
foreach ($logs as $index => $log) {
PhutilTypeSpec::checkMap(
$log,
array(
'path' => 'string',
));
$path = $log['path'];
try {
$dir = dirname($path);
if (!Filesystem::pathExists($dir)) {
Filesystem::createDirectory($dir, 0755, true);
}
} catch (FilesystemException $ex) {
throw new PhutilArgumentUsageException(
pht(
'Failed to create directory "%s" for specified log file (with '.
'index "%s"). You should manually create this directory or '.
'choose a different logfile location. %s',
$dir,
$index,
$ex->getMessage()));
}
}
$peer_map = array();
$cluster = idx($data, 'cluster', array());
foreach ($cluster as $index => $peer) {
PhutilTypeSpec::checkMap(
$peer,
array(
'host' => 'string',View on GitHub (pinned to 5720a38cfe)
Solutions
- Pre-create the directory with correct ownership: sudo mkdir -p /var/log/aphlict && sudo chown <aphlict-user> /var/log/aphlict
- Or point "path" at a writable location such as /var/tmp/aphlict.log or the Phabricator log directory
- Check the appended OS message for SELinux/AppArmor or read-only-filesystem causes and adjust policy accordingly
Example fix
# before: config path /var/log/aphlict/aphlict.log, dir missing, run as user 'aphlict' sudo mkdir -p /var/log/aphlict sudo chown aphlict:aphlict /var/log/aphlict # after: bin/aphlict start succeeds
Defensive patterns
Strategy: validation
Validate before calling
$path = $log['path'];
$dir = dirname($path);
if (!Filesystem::pathExists($dir) && !is_writable(dirname($dir))) {
throw new InvalidArgumentException("Cannot create log directory {$dir}: check permissions");
} Try / catch
try {
Filesystem::createDirectory($dir, 0755, true);
} catch (FilesystemException $ex) {
// Read $ex->getMessage() for EACCES/EROFS and fix ownership or path.
} Prevention
- Provision log directories in your config management with correct ownership before first start
- Point logs at paths the service user owns; avoid root-owned trees like /var/log without chown
When it happens
Trigger: A "logs" entry like {"path": "/var/log/aphlict/aphlict.log"} where /var/log/aphlict does not exist and the invoking user cannot create it (EACCES), or a path under a read-only filesystem.
Common situations: Running aphlict as a non-root service user but pointing logs into /var/log owned by root; SELinux denying writes; typo'd path like /varr/log.
Related errors
- Failed to create directory "%s" for specified PID file. You
- Configuration file "%s" exists, but could not be read.
- Failed to open output file "%s" for writing.
- Unable to change ownership of an identity file to daemon use
- Specify a user to notify with "--user".
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/07675462cb041b9c.
Report an issue: GitHub.