{"record":{"id":"97ddc07a9a8b345d","repo":"phacility/phabricator","slug":"path-s-contains-no-libphutil-libraries","errorCode":null,"errorMessage":"Path \"%s\" contains no libphutil libraries.","messagePattern":"Path \"(.+?)\" contains no libphutil libraries\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php","lineNumber":50,"sourceCode":"      $paths = array(getcwd());\n    }\n\n    $targets = array();\n    foreach ($paths as $path) {\n      $root = Filesystem::resolvePath($path);\n\n      if (!Filesystem::pathExists($root) || !is_dir($root)) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Path \"%s\" does not exist, or is not a directory.',\n            $path));\n      }\n\n      $libraries = id(new FileFinder($path))\n        ->withPath('*/__phutil_library_init__.php')\n        ->find();\n      if (!$libraries) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Path \"%s\" contains no libphutil libraries.',\n            $path));\n      }\n\n      foreach ($libraries as $library) {\n        $targets[] = Filesystem::resolvePath(dirname($path.'/'.$library)).'/';\n      }\n    }\n\n    $targets = array_unique($targets);\n\n    foreach ($targets as $library) {\n      echo tsprintf(\n        \"**<bg:blue> %s </bg>** %s\\n\",\n        pht('EXTRACT'),\n        pht(\n          'Extracting \"%s\"...',","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/infrastructure/internationalization/management/PhabricatorInternationalizationManagementExtractWorkflow.php#L32-L68","documentation":"A PhutilArgumentUsageException from 'bin/i18n extract'. After confirming each path is a directory, the command searches it with FileFinder for files named '__phutil_library_init__.php' — the marker of a phutil library root. If none exist anywhere under the path, there is nothing to extract from, so the command aborts.","triggerScenarios":"Pointing the extractor at a plain directory tree that is not a phutil/arcanist library (no __phutil_library_init__.php); extracting against a bare git checkout of a non-library project.","commonSituations":"Running i18n extract over a random project directory instead of the phabricator (or arcanist/libphutil) source tree; extracting against a directory where the library marker file was excluded by a sparse checkout or .gitignore.","solutions":["Run the command against a directory that contains (at any depth) a __phutil_library_init__.php, typically the phabricator checkout root","If extracting your own library, initialize it first with libphutil's library initialization so the marker file exists","Check sparse-checkout/rsync filters are not excluding the marker file"],"exampleFix":"# before: directory has no phutil library\n$ bin/i18n extract /tmp/notalibrary\n\n# after: point at a real library root\n$ bin/i18n extract /srv/phabricator","handlingStrategy":"validation","validationCode":"// Confirm the target actually contains a phutil library before extracting.\n$found = id(new FileFinder($path))\n  ->withPath('*/__phutil_library_init__.php')\n  ->find();\nif (!$found) {\n  fwrite(STDERR, \"No __phutil_library_init__.php under {$path}\\n\");\n  exit(1);\n}","typeGuard":"function containsPhutilLibrary($path) {\n  return (bool)id(new FileFinder($path))\n    ->withPath('*/__phutil_library_init__.php')\n    ->find();\n}","tryCatchPattern":"try { $workflow->execute($args); } catch (PhutilArgumentUsageException $ex) { fwrite(STDERR, $ex->getMessage().\"\\n\"); exit(1); }","preventionTips":["Only run i18n extract against the phabricator/arcanist/libphutil checkouts or a directory containing an initialized phutil library","In scripts, assert the marker file exists before invoking the command"],"tags":["cli","i18n","libphutil","usage-error","phabricator"],"backgroundTag":"library-not-found","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}