{"record":{"id":"e010f15845a0e7cc","repo":"phacility/phabricator","slug":"device-s-is-unrecognized-restricted-or-you-do","errorCode":null,"errorMessage":"Device \"%s\" is unrecognized, restricted, or you do not have permission to edit it.","messagePattern":"Device \"(.+?)\" is unrecognized, restricted, or you do not have permission to edit it\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/almanac/editor/AlmanacInterfaceEditEngine.php","lineNumber":85,"sourceCode":"\n    if ($device_phid === null) {\n      throw new Exception(\n        pht(\n          'When creating a new Almanac interface via the Conduit API, you '.\n          'must provide a \"device\" transaction to select a device.'));\n    }\n\n    $device = id(new AlmanacDeviceQuery())\n      ->setViewer($this->getViewer())\n      ->withPHIDs(array($device_phid))\n      ->requireCapabilities(\n        array(\n          PhabricatorPolicyCapability::CAN_VIEW,\n          PhabricatorPolicyCapability::CAN_EDIT,\n        ))\n      ->executeOne();\n    if (!$device) {\n      throw new Exception(\n        pht(\n          'Device \"%s\" is unrecognized, restricted, or you do not have '.\n          'permission to edit it.',\n          $device_phid));\n    }\n\n    $this->setDevice($device);\n\n    return $this->newEditableObject();\n  }\n\n  protected function newObjectQuery() {\n    return new AlmanacInterfaceQuery();\n  }\n\n  protected function getObjectCreateTitleText($object) {\n    return pht('Create Interface');\n  }","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/almanac/editor/AlmanacInterfaceEditEngine.php#L67-L103","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n$slug = 'widget framework 2.0 (dev)';\n\n// after\n$slug = preg_replace('/[^a-zA-Z0-9._-]+/', '-', 'widget framework 2.0 dev'); // 'widget-framework-2-0-dev-'","handlingStrategy":"type-guard","validationCode":"$slug = preg_replace('/[^a-zA-Z0-9._-]+/', '-', $raw_name);","typeGuard":"function isValidShortName($slug) {\n  return PhabricatorRepository::isValidRepositorySlug((string)$slug);\n}","tryCatchPattern":"try {\n  PhabricatorRepository::assertValidRepositorySlug($slug);\n} catch (Exception $ex) {\n  // reject the value and echo the rule back to the user\n}","preventionTips":["Never feed human titles directly as short names; sanitize first.","Use the character-class replacement '/[^a-zA-Z0-9._-]+/' so runs collapse too."],"tags":["phabricator","php","validation","repository-shortname","invalid-characters"],"backgroundTag":"invalid-characters-in-identifier","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}