phacility/phabricator · warning · PhabricatorApplicationTransactionValidationException

This alias is already in use.

Error message

This alias is already in use.

What it means

When applying Phurl URL transactions, PhabricatorPhurlURLEditor::didCatchDuplicateKeyException() traps the MySQL duplicate-key error on the unique alias column and rethrows it as PhabricatorApplicationTransactionValidationException with the human message 'This alias is already in use.'. It is a form-level validation error: the save is cleanly rejected with no partial write, and the error is attached to the alias transaction type.

Source

Thrown at src/applications/phurl/editor/PhabricatorPhurlURLEditor.php:107

      PhabricatorEnv::getProductionURI('/U'.$object->getID()));


    return $body;
  }

  protected function didCatchDuplicateKeyException(
    PhabricatorLiskDAO $object,
    array $xactions,
    Exception $ex) {

    $errors = array();
    $errors[] = new PhabricatorApplicationTransactionValidationError(
      PhabricatorPhurlURLAliasTransaction::TRANSACTIONTYPE,
      pht('Duplicate'),
      pht('This alias is already in use.'),
      null);

    throw new PhabricatorApplicationTransactionValidationException($errors);
  }

  protected function buildReplyHandler(PhabricatorLiskDAO $object) {
    return id(new PhabricatorPhurlURLReplyHandler())
      ->setMailReceiver($object);
  }

}

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pick a different alias and resubmit
  2. If the alias appears unused, check for a soft-deleted URL still holding it and restore or destroy that row
  3. Catch PhabricatorApplicationTransactionValidationException and render the error next to the alias field instead of crashing
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check alias availability before applying transactions.
$conflict = id(new PhabricatorPhurlURLQuery())
  ->setViewer(PhabricatorUser::getOmnipotentUser())
  ->withAliases(array($alias))
  ->executeOne();
if ($conflict) {
  // surface a field error now instead of failing the save
}

Try / catch

try {
  id(new PhabricatorPhurlURLEditor())
    ->setActor($viewer)
    ->setContentSource($source)
    ->applyTransactions($url, $xactions);
} catch (PhabricatorApplicationTransactionValidationException $ex) {
  foreach ($ex->getErrors() as $error) {
    // render 'This alias is already in use.' next to the alias field
  }
}

Prevention

When it happens

Trigger: Creating a Phurl URL, or renaming one, to an alias that another URL already holds, hitting the unique key on the alias column during the transaction.

Common situations: Two users claiming the same short alias concurrently; double-submitted forms; aliases still held by soft-deleted URLs so the alias looks free in the list but is not.

Related errors


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