{"record":{"id":"07675462cb041b9c","repo":"phacility/phabricator","slug":"failed-to-create-directory-s-for-specified-log","errorCode":null,"errorMessage":"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","messagePattern":"Failed to create directory \"(.+?)\" for specified log file \\(with index \"(.+?)\"\\)\\. You should manually create this directory or choose a different logfile location\\. (.+?)","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php","lineNumber":214,"sourceCode":"    }\n\n    $logs = idx($data, 'logs', array());\n    foreach ($logs as $index => $log) {\n      PhutilTypeSpec::checkMap(\n        $log,\n        array(\n          'path' => 'string',\n        ));\n\n      $path = $log['path'];\n\n      try {\n        $dir = dirname($path);\n        if (!Filesystem::pathExists($dir)) {\n          Filesystem::createDirectory($dir, 0755, true);\n        }\n      } catch (FilesystemException $ex) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Failed to create directory \"%s\" for specified log file (with '.\n            'index \"%s\"). You should manually create this directory or '.\n            'choose a different logfile location. %s',\n            $dir,\n            $index,\n            $ex->getMessage()));\n      }\n    }\n\n    $peer_map = array();\n\n    $cluster = idx($data, 'cluster', array());\n    foreach ($cluster as $index => $peer) {\n      PhutilTypeSpec::checkMap(\n        $peer,\n        array(\n          'host' => 'string',","sourceCodeStart":196,"sourceCodeEnd":232,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/aphlict/management/PhabricatorAphlictManagementWorkflow.php#L196-L232","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before: config path /var/log/aphlict/aphlict.log, dir missing, run as user 'aphlict'\nsudo mkdir -p /var/log/aphlict\nsudo chown aphlict:aphlict /var/log/aphlict\n# after: bin/aphlict start succeeds","handlingStrategy":"validation","validationCode":"$path = $log['path'];\n$dir = dirname($path);\nif (!Filesystem::pathExists($dir) && !is_writable(dirname($dir))) {\n  throw new InvalidArgumentException(\"Cannot create log directory {$dir}: check permissions\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  Filesystem::createDirectory($dir, 0755, true);\n} catch (FilesystemException $ex) {\n  // Read $ex->getMessage() for EACCES/EROFS and fix ownership or path.\n}","preventionTips":["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"],"tags":["aphlict","filesystem","permissions","logging","phabricator"],"backgroundTag":"filesystem-permission-denied","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}