phacility/phabricator · error · Exception

Unknown SVN file kind '%s'.

Error message

Unknown SVN file kind '%s'.

What it means

getFileTypeFromSVNKind() maps the kind attribute of svn ls --xml entries to FILE_DIRECTORY ('dir') or FILE_NORMAL ('file'); any other kind string throws (PhabricatorRepositorySvnCommitChangeParserWorker.php:632-638). On the visible call path the value is constrained by the entry regex to (file|dir), so this is largely a defensive check against future SVN output changes or other call sites.

Source

Thrown at src/applications/repository/worker/commitchangeparser/PhabricatorRepositorySvnCommitChangeParserWorker.php:635

      }
    }

    foreach ($paths as $path => $lookup) {
      if (empty($result_map[$path])) {
        $result_map[$path] = DifferentialChangeType::FILE_DELETED;
      }
    }

    return $result_map;
  }

  private function getFileTypeFromSVNKind($kind) {
    $kind = (string)$kind;
    switch ($kind) {
      case 'dir':   return DifferentialChangeType::FILE_DIRECTORY;
      case 'file':  return DifferentialChangeType::FILE_NORMAL;
      default:
        throw new Exception(pht("Unknown SVN file kind '%s'.", $kind));
    }
  }

  private function lookupRecursiveFileList(
    PhabricatorRepository $repository,
    array $info) {

    $path = $info['rawPath'];
    $rev  = $info['rawCommit'];

    $path_uri = $repository->getSubversionPathURI($path, $rev);
    $hashkey = md5($path_uri);

    // This method is quite horrible. The underlying challenge is that some
    // commits in the Facebook repository are enormous, taking multiple hours
    // to 'ls -R' out of the repository and producing XML files >1GB in size.

    // If we try to SimpleXML them, the object exhausts available memory on a

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Reproduce: run svn ls --xml on the failing path and inspect the kind attribute
  2. Pin the svn client to a version whose output matches the parser's expectations
  3. Patch the parser locally to handle the new kind and report it upstream
Defensive patterns

Strategy: try-catch

Validate before calling

// Confirm the svn client emits only known kinds (pre-flight in dev):
//   svn ls --xml <repo-url> | grep -o 'kind="[^"]*"' | sort -u
// Expect exactly kind="file" and kind="dir".

Type guard

function isKnownSvnKind($kind) {
  return in_array((string)$kind, array('dir', 'file'), true);
}

Try / catch

try {
  $type = $this->getFileTypeFromSVNKind($kind);
} catch (Exception $ex) {
  // Unknown node kind from svn ls --xml: pin/change the svn client or
  // patch the parser; log the raw kind for diagnosis.
  phlog(pht('Unknown SVN kind: %s', $kind));
  throw $ex;
}

Prevention

When it happens

Trigger: An svn client or server emitting a new node-kind value in the XML; other code paths passing an unexpected kind string; whitespace/encoding noise making the captured group differ from 'file'/'dir'.

Common situations: Upgrading the svn binary on the Phabricator host to a version with changed output; unusual SVN server implementations or gateways.

Related errors


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