phacility/phabricator · error · Exception

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

Error message

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

What it means

Thrown by `bin/repository move-paths` when the `--from` argument is missing or an empty string (`!strlen($from)`). The workflow batch-rewrites the `localPath` column for every repository whose local path starts with the prefix, so it refuses to guess the source prefix. Thrown as a plain `Exception` (not a usage exception).

Source

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

            'help' => pht('Apply changes without prompting.'),
          ),
        ));
  }

  public function execute(PhutilArgumentParser $args) {
    $console = PhutilConsole::getConsole();

    $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();

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Supply the source prefix: `./bin/repository move-paths --from /old/repo --to /new/repo`.
  2. In scripts, default the variables and assert non-empty before invoking.
  3. Dry-run first without `--force` to review the table of rewrites it proposes.

Example fix

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

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

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: Running `./bin/repository move-paths --to /new/repo` and forgetting `--from`; passing `--from ""` from a script where the variable is empty; omitting both flags.

Common situations: Storage migrations after moving the repository root (`/repos` → `/srv/repos`); wrapper scripts with an unset `$FROM` shell variable.

Related errors


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