{"record":{"id":"4eb844d85dd99a0e","repo":"phacility/phabricator","slug":"specified-pkcs8-keyfile-s-does-not-exist","errorCode":null,"errorMessage":"Specified pkcs8 keyfile \"%s\" does not exist!","messagePattern":"Specified pkcs8 keyfile \"(.+?)\" does not exist!","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php","lineNumber":60,"sourceCode":"    if (!Filesystem::pathExists($public_keyfile)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specified public keyfile \"%s\" does not exist!',\n          $public_keyfile));\n    }\n\n    $public_key = Filesystem::readFile($public_keyfile);\n\n    $pkcs8_keyfile = $args->getArg('pkcs8');\n    if (!strlen($pkcs8_keyfile)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'You must specify the path to a pkcs8 keyfile with %s.',\n          '--pkc8s'));\n    }\n\n    if (!Filesystem::pathExists($pkcs8_keyfile)) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Specified pkcs8 keyfile \"%s\" does not exist!',\n          $pkcs8_keyfile));\n    }\n\n    $pkcs8_key = Filesystem::readFile($pkcs8_keyfile);\n\n    $warning = pht(\n      'Adding a PKCS8 keyfile to the cache can be very dangerous. If the '.\n      'PKCS8 file really encodes a different public key than the one '.\n      'specified, an attacker could use it to gain unauthorized access.'.\n      \"\\n\\n\".\n      'Generally, you should use this option only in a development '.\n      'environment where ssh-keygen is broken and it is inconvenient to '.\n      'fix it, and only if you are certain you understand the risks. You '.\n      'should never cache a PKCS8 file you did not generate yourself.');\n\n    $console->writeOut(","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/auth/management/PhabricatorAuthManagementCachePKCS8Workflow.php#L42-L78","documentation":"--pkcs8 was provided, but Filesystem::pathExists() finds no file at that path, so the workflow aborts before reading the PKCS8 key. Same path-resolution failure as the public-keyfile check, applied to the PKCS8 side.","triggerScenarios":"Typo in the PKCS8 path; relative path resolved from a different cwd; the .pkcs8 file was never generated (e.g. ssh-keygen -e -m PKCS8 was never run) or lives on another host.","commonSituations":"Forgetting to generate the PKCS8 wrapper first; running from the wrong directory; container/host path confusion.","solutions":["Verify the file exists: ls -l <path> from the invocation directory.","Generate the PKCS8 file if missing: ssh-keygen -e -m PKCS8 -f /path/id_rsa.pub > /path/id_rsa.pkcs8 (only then cache it).","Use an absolute path."],"exampleFix":"// before: pkcs8 file not generated yet\n./bin/auth cache-pkcs8 --public key.pub --pkcs8 key.pkcs8\n// after: generate it first, then cache\nssh-keygen -e -m PKCS8 -f key.pub > key.pkcs8\n./bin/auth cache-pkcs8 --public key.pub --pkcs8 key.pkcs8","handlingStrategy":"validation","validationCode":"# guard: file must exist before invoking\nPKCS8=$(readlink -f \"$PKCS8\")\n[ -f \"$PKCS8\" ] || { echo \"pkcs8 keyfile missing: $PKCS8\" >&2; exit 2; }\n./bin/auth cache-pkcs8 --public \"$PUB\" --pkcs8 \"$PKCS8\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Generate the PKCS8 file first: ssh-keygen -e -m PKCS8 -f key.pub > key.pkcs8.","Use absolute paths.","Verify the file exists in the environment running bin/auth."],"tags":["cli","file-not-found","cache-pkcs8","phabricator"],"backgroundTag":"cli-file-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}