phacility/phabricator · error · Exception
Service "%s" is unrecognized, restricted, or you do not have
Error message
Service "%s" is unrecognized, restricted, or you do not have permission to edit it.
What it means
Thrown by PhabricatorRepository::assertValidRepositorySlug() when validating a repository short name (slug) that is the empty string. The slug becomes the canonical 'rh.../shortname' clone URI component, so an empty value is structurally invalid. The assertion runs when a short-name transaction sets the value (PhabricatorRepositorySlugTransaction), e.g. via the UI or the 'repository.edit' Conduit method, and is wrapped by isValidRepositorySlug() for non-throwing checks.
Source
Thrown at src/applications/almanac/editor/AlmanacBindingEditEngine.php:81
if ($service_phid === null) {
throw new Exception(
pht(
'When creating a new Almanac binding via the Conduit API, you '.
'must provide a "service" transaction to select a service to bind.'));
}
$service = id(new AlmanacServiceQuery())
->setViewer($this->getViewer())
->withPHIDs(array($service_phid))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$service) {
throw new Exception(
pht(
'Service "%s" is unrecognized, restricted, or you do not have '.
'permission to edit it.',
$service_phid));
}
$this->setService($service);
return $this->newEditableObject();
}
protected function newObjectQuery() {
return id(new AlmanacBindingQuery())
->needProperties(true);
}
protected function getObjectCreateTitleText($object) {
return pht('Create Binding');View on GitHub (pinned to 5720a38cfe)
Solutions
- Omit the short-name transaction entirely when no short name is wanted, instead of sending an empty value.
- Populate the slug field with a valid name (letters, numbers, periods, hyphens, underscores, 1-64 chars).
- Guard scripts with PhabricatorRepository::isValidRepositorySlug($slug) before applying the transaction.
Example fix
// before
$transactions[] = id(new PhabricatorRepositoryTransaction())
->setTransactionType(PhabricatorRepositorySlugTransaction::TRANSACTIONTYPE)
->setNewValue($slug); // $slug == ''
// after
if (strlen($slug)) {
$transactions[] = id(new PhabricatorRepositoryTransaction())
->setTransactionType(PhabricatorRepositorySlugTransaction::TRANSACTIONTYPE)
->setNewValue($slug);
} Defensive patterns
Strategy: type-guard
Validate before calling
if (!strlen($slug)) { /* skip the short-name transaction entirely */ } Type guard
function isValidShortName($slug) {
return PhabricatorRepository::isValidRepositorySlug((string)$slug);
} Try / catch
try {
PhabricatorRepository::assertValidRepositorySlug($slug);
} catch (Exception $ex) {
// show $ex->getMessage() next to the form field / in the Conduit error
} Prevention
- Only append a slug transaction when the value is non-empty.
- Run isValidRepositorySlug() in provisioning scripts before applying edits.
When it happens
Trigger: Applying a repository.edit transaction that sets 'slug' (short name) to '' — e.g. building transactions in a script where the slug variable is empty: PhabricatorRepositorySlugTransaction.php:62 calls assertValidRepositorySlug('') and the !strlen($slug) guard at PhabricatorRepository.php:371 throws.
Common situations: Automation scripts that always send a 'set slug' transaction even when no short name is configured, sending an empty string; UI forms submitting before the short-name field is filled; migrating repositories where the callsign-to-slug conversion produced '' (the storage layer falls back to the callsign elsewhere, but an explicit empty transaction still fails).
Related errors
- When creating a new Almanac interface via the Conduit API, y
- Device "%s" is unrecognized, restricted, or you do not have
- Interfaces must have a unique combination of network, device
- Another namespace with this name already exists. Each namesp
- 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/a70d29722d1d2b52.
Report an issue: GitHub.