phacility/phabricator · error · Exception

Something is wrong; source of a copy must exist.

Error message

Something is wrong; source of a copy must exist.

What it means

While parsing an SVN commit, a copy operation's source path was looked up at the copy revision and came back as DELETED, which contradicts SVN semantics: a copy source must exist at its revision (PhabricatorRepositorySvnCommitChangeParserWorker.php:193-206). Phabricator treats this as an integrity error in the SVN history or in the lookup layer.

Source

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

            } else {
              if (isset($deleted_paths[$copy_from])) {
                $type = DifferentialChangeType::TYPE_MOVE_HERE;
                $other_type = DifferentialChangeType::TYPE_MOVE_AWAY;
              } else {
                $type = DifferentialChangeType::TYPE_COPY_HERE;
                $other_type = DifferentialChangeType::TYPE_COPY_AWAY;
              }

              $source_file_type = $this->lookupPathFileType(
                $repository,
                $copy_from,
                array(
                  'rawPath'   => $copy_from,
                  'rawCommit' => $copy_rev,
                ));

              if ($source_file_type == DifferentialChangeType::FILE_DELETED) {
                throw new Exception(
                  pht('Something is wrong; source of a copy must exist.'));
              }

              if ($source_file_type != DifferentialChangeType::FILE_DIRECTORY) {
                if (isset($raw_paths[$copy_from]) ||
                    isset($effects[$copy_from])) {
                  break;
                }
                $effects[$copy_from] = array(
                  'rawPath'           => $copy_from,
                  'rawTargetPath'     => null,
                  'rawTargetCommit'   => null,
                  'rawDirect'         => false,

                  'changeType'        => $other_type,
                  'fileType'          => $source_file_type,
                );
              } else {

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Verify the source exists: svn ls -r <copy_rev> <repo-url>/<copy_from> - if missing, the history itself is broken
  2. Re-import from an unfiltered dump, or configure subdirectory import (svn-subpath) so foreign sources become stub commits
  3. If the source verifiably exists in SVN, report it upstream as a parser bug
Defensive patterns

Strategy: try-catch

Validate before calling

// Before importing, verify copy sources exist in the SVN history:
//   svn log -v <repo-url> | grep '   A /path (from ...)'  # then check each source
//   svn ls -r <copy_rev> <repo-url>/<copy_from>

Try / catch

try {
  $changes = $this->parseSVNCommit($repository, $commit);
} catch (Exception $ex) {
  // Copy source reported deleted: history integrity problem. Verify with
  // 'svn ls -r <rev> <path>'; fix the history or switch to subdirectory
  // import rather than retrying.
  phlog($ex);
  throw $ex;
}

Prevention

When it happens

Trigger: SVN repositories whose history was filtered or rewritten (svndumpfilter) so a copy references a path that no longer exists at the copy revision; lookups against a partial or desynchronized mirror; genuinely corrupted SVN repositories.

Common situations: SVN repos split or filtered before import, creating dangling copy sources; partial mirrors missing historic revisions; repository surgery artifacts.

Related errors


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