phacility/phabricator · error · PhabricatorApplicationTransactionValidationException

Interfaces must have a unique combination of network, device

Error message

Interfaces must have a unique combination of network, device, address, and port.

What it means

Thrown by PhabricatorRepository::assertValidRepositorySlug() when a repository short name does not start with a letter or number. Leading periods, hyphens, or underscores are rejected because they create hidden files ('.name'), break URI parsing, or cause path/tooling quirks. The rule is enforced by the preg_match('/^[a-zA-Z0-9]/', $slug) check when a short name is set via the UI or 'repository.edit'.

Source

Thrown at src/applications/almanac/editor/AlmanacInterfaceEditor.php:33

    return pht('%s created %s.', $author, $object);
  }

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

    $errors = array();

    $errors[] = new PhabricatorApplicationTransactionValidationError(
      null,
      pht('Invalid'),
      pht(
        'Interfaces must have a unique combination of network, device, '.
        'address, and port.'),
      null);

    throw new PhabricatorApplicationTransactionValidationException($errors);
  }

}

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Start the short name with a letter or digit ('_utils' -> 'utils', '.internal' -> 'internal').
  2. After sanitizing generated names, trim leading separators: ltrim($slug, '._-').
  3. Validate with PhabricatorRepository::isValidRepositorySlug() before submitting.

Example fix

// before
$slug = '_internal_tools';

// after
$slug = ltrim(preg_replace('/[^a-zA-Z0-9._-]+/', '-', '_internal_tools'), '._-'); // 'internal_tools'
Defensive patterns

Strategy: type-guard

Validate before calling

$slug = ltrim($slug, '._-');

Type guard

function isValidShortName($slug) {
  return PhabricatorRepository::isValidRepositorySlug((string)$slug);
}

Try / catch

try {
  PhabricatorRepository::assertValidRepositorySlug($slug);
} catch (Exception $ex) {
  // strip leading separators and revalidate, or reject
}

Prevention

When it happens

Trigger: Setting a short name like '-utils' or '.internal': the start-anchor regex at PhabricatorRepository.php:395 fails to find an initial letter/digit and throws.

Common situations: Convention-based naming with leading underscores or hyphens for 'internal' repos; auto-generated slugs that begin with a separator after sanitization stripped leading characters (e.g. '###repo' -> '-repo'); dotfile-style naming habits.

Related errors


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