phacility/phabricator · error · PhabricatorApplicationTransactionValidationException
Another namespace with this name already exists. Each namesp
Error message
Another namespace with this name already exists. Each namespace must have a unique name.
What it means
Thrown by PhabricatorRepository::assertValidRepositorySlug() when a repository short name does not end with a letter or number. Trailing separators are rejected to avoid accidental double separators when the slug is joined into URIs or paths and to keep clone URLs clean. It is raised from the preg_match('/[a-zA-Z0-9]\z/', $slug) check when the short-name transaction applies a value ending in '.', '-', or '_'.
Source
Thrown at src/applications/almanac/editor/AlmanacNamespaceEditor.php:46
return $types;
}
protected function didCatchDuplicateKeyException(
PhabricatorLiskDAO $object,
array $xactions,
Exception $ex) {
$errors = array();
$errors[] = new PhabricatorApplicationTransactionValidationError(
null,
pht('Invalid'),
pht(
'Another namespace with this name already exists. Each namespace '.
'must have a unique name.'),
null);
throw new PhabricatorApplicationTransactionValidationException($errors);
}
}
View on GitHub (pinned to 5720a38cfe)
Solutions
- Trim trailing separators from the name: rtrim($slug, '._-').
- Review generated slugs after character replacement and length truncation, since both can leave a dangling separator.
- Pre-validate with PhabricatorRepository::isValidRepositorySlug().
Example fix
// before
$slug = preg_replace('/[^a-zA-Z0-9._-]/', '-', 'widget (dev)'); // 'widget--dev-'
// after
$slug = rtrim(preg_replace('/[^a-zA-Z0-9._-]+/', '-', 'widget (dev)'), '._-'); // 'widget-dev' Defensive patterns
Strategy: type-guard
Validate before calling
$slug = rtrim($slug, '._-');
Type guard
function isValidShortName($slug) {
return PhabricatorRepository::isValidRepositorySlug((string)$slug);
} Try / catch
try {
PhabricatorRepository::assertValidRepositorySlug($slug);
} catch (Exception $ex) {
// strip trailing separators and revalidate, or reject
} Prevention
- Trim trailing '._-' after sanitization and after length truncation.
- Add UI hints that short names must end with a letter or number.
When it happens
Trigger: Setting a short name like 'utils-' or 'repo.': the end-anchor regex at PhabricatorRepository.php:403 finds no trailing letter/digit and throws.
Common situations: Sanitizer pipelines that replace invalid runs with hyphens but never trim the tail ('widget (dev)' -> 'widget-dev-'); names truncated mid-separator by length limits; copy-paste trailing punctuation.
Related errors
- Interfaces must have a unique combination of network, device
- Service "%s" is unrecognized, restricted, or you do not have
- When creating a new Almanac interface via the Conduit API, y
- Device "%s" is unrecognized, restricted, or you do not have
- When creating a new Almanac service via the Conduit API, you
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/48f0afe7fd6cce3a.
Report an issue: GitHub.