phacility/phabricator · error · Exception

Expected "<mode> <type> <hash> <size>\t<name>", for ls-tree

Error message

Expected "<mode> <type> <hash> <size>\t<name>", for ls-tree of "%s:%s", got: %s

What it means

Error "Expected "<mode> <type> <hash> <size>\t<name>", for ls-tree of "%s:%s", got: %s" thrown in phacility/phabricator.

Source

Thrown at src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php:161

        $path);
    }

    $submodules = array();

    $count = 0;
    $results = array();
    $lines = empty($stdout)
           ? array()
           : explode("\0", rtrim($stdout));

    foreach ($lines as $line) {
      // NOTE: Limit to 5 components so we parse filenames with spaces in them
      // correctly.
      // NOTE: The output uses a mixture of tabs and one-or-more spaces to
      // delimit fields.
      $parts = preg_split('/\s+/', $line, 5);
      if (count($parts) < 5) {
        throw new Exception(
          pht(
            'Expected "<mode> <type> <hash> <size>\t<name>", for ls-tree of '.
            '"%s:%s", got: %s',
            $commit,
            $path,
            $line));
      }

      list($mode, $type, $hash, $size, $full_path) = $parts;

      $path_result = new DiffusionRepositoryPath();

      if ($type == 'tree') {
        $file_type = DifferentialChangeType::FILE_DIRECTORY;
      } else if ($type == 'commit') {
        $file_type = DifferentialChangeType::FILE_SUBMODULE;
        $submodules[] = $path_result;
      } else {

View on GitHub (pinned to 5720a38cfe)

When it happens

Trigger: Thrown at src/applications/diffusion/conduit/DiffusionBrowseQueryConduitAPIMethod.php:161 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/6d90a2050b9631f3. Report an issue: GitHub.