phacility/phabricator · error · Exception

You must specify a path prefix to move to with --to.

Error message

You must specify a path prefix to move to with --to.

What it means

Thrown by `bin/repository move-paths` when `--to` is missing or empty (`!strlen($to)`), the counterpart of the `--from` check. The workflow rewrites repository `localPath` values from the old prefix to the new prefix (via `UPDATE ... SET localPath = %s`), so both ends of the mapping must be provided.

Source

Thrown at src/applications/repository/management/PhabricatorRepositoryManagementMovePathsWorkflow.php:49

    $repos = id(new PhabricatorRepositoryQuery())
      ->setViewer($this->getViewer())
      ->execute();
    if (!$repos) {
      $console->writeErr("%s\n", pht('There are no repositories.'));
      return 0;
    }

    $from = $args->getArg('from');
    if (!strlen($from)) {
      throw new Exception(
        pht(
          'You must specify a path prefix to move from with --from.'));
    }

    $to = $args->getArg('to');
    if (!strlen($to)) {
      throw new Exception(
        pht(
          'You must specify a path prefix to move to with --to.'));
    }

    $is_force = $args->getArg('force');

    $rows = array();

    $any_changes = false;
    foreach ($repos as $repo) {
      $src = $repo->getLocalPath();

      $row = array(
        'repository' => $repo,
        'move' => false,
        'monogram' => $repo->getMonogram(),
        'src' => $src,
        'dst' => '',

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Supply the destination prefix: `./bin/repository move-paths --from /old --to /new`.
  2. Assert both variables are non-empty in automation: `: "${FROM:?}" "${TO:?}"`.
  3. Review the proposed rewrites in the confirmation table before confirming.

Example fix

// before
$ ./bin/repository move-paths --from /var/repos
[1178] You must specify a path prefix to move to with --to.

// after
$ ./bin/repository move-paths --from /var/repos --to /srv/repos
Defensive patterns

Strategy: validation

Validate before calling

: "${TO:?--to prefix required}"
./bin/repository move-paths --from "$FROM" --to "$TO"

Prevention

When it happens

Trigger: Running `./bin/repository move-paths --from /old/repo` without `--to`; `--to "$TO"` in a script where TO is unset.

Common situations: Half-written migration commands after reorganizing storage; scripts that compute the destination with a failed command substitution, yielding an empty string.

Related errors


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