phacility/phabricator · error · Exception
Device "%s" is unrecognized, restricted, or you do not have
Error message
Device "%s" is unrecognized, restricted, or you do not have permission to edit it.
What it means
Thrown by PhabricatorRepository::assertValidRepositorySlug() when a repository short name contains characters outside the allowed set [a-zA-Z0-9._-]. Short names are embedded in clone URIs and directory paths, so spaces, slashes, and other special characters are rejected to keep URIs safe and paths unambiguous. It is raised when a short-name transaction (UI or 'repository.edit') supplies such a value.
Source
Thrown at src/applications/almanac/editor/AlmanacInterfaceEditEngine.php:85
if ($device_phid === null) {
throw new Exception(
pht(
'When creating a new Almanac interface via the Conduit API, you '.
'must provide a "device" transaction to select a device.'));
}
$device = id(new AlmanacDeviceQuery())
->setViewer($this->getViewer())
->withPHIDs(array($device_phid))
->requireCapabilities(
array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
))
->executeOne();
if (!$device) {
throw new Exception(
pht(
'Device "%s" is unrecognized, restricted, or you do not have '.
'permission to edit it.',
$device_phid));
}
$this->setDevice($device);
return $this->newEditableObject();
}
protected function newObjectQuery() {
return new AlmanacInterfaceQuery();
}
protected function getObjectCreateTitleText($object) {
return pht('Create Interface');
}View on GitHub (pinned to 5720a38cfe)
Solutions
- Replace disallowed characters: use hyphens or underscores for spaces and drop other symbols.
- Normalize names in code: preg_replace('/[^a-zA-Z0-9._-]+/', '-', $name).
- Pre-check with PhabricatorRepository::isValidRepositorySlug() before applying the transaction.
Example fix
// before
$slug = 'widget framework 2.0 (dev)';
// after
$slug = preg_replace('/[^a-zA-Z0-9._-]+/', '-', 'widget framework 2.0 dev'); // 'widget-framework-2-0-dev-' Defensive patterns
Strategy: type-guard
Validate before calling
$slug = preg_replace('/[^a-zA-Z0-9._-]+/', '-', $raw_name); Type guard
function isValidShortName($slug) {
return PhabricatorRepository::isValidRepositorySlug((string)$slug);
} Try / catch
try {
PhabricatorRepository::assertValidRepositorySlug($slug);
} catch (Exception $ex) {
// reject the value and echo the rule back to the user
} Prevention
- Never feed human titles directly as short names; sanitize first.
- Use the character-class replacement '/[^a-zA-Z0-9._-]+/' so runs collapse too.
When it happens
Trigger: Setting a short name containing spaces, slashes, or Unicode, e.g. 'My Repo/öffen': the preg_match('/[^a-zA-Z0-9._-]/', $slug) check at PhabricatorRepository.php:386 matches and throws with the offending name.
Common situations: Copy-pasting human repository titles ('Widget Framework 2.0') into the short-name field; converting arbitrary directory names with spaces or colons into slugs; localized names with accented characters.
Related errors
- Service "%s" is unrecognized, restricted, or you do not have
- When creating a new Almanac interface via the Conduit API, y
- 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/e010f15845a0e7cc.
Report an issue: GitHub.