{"record":{"id":"6912102bee6c0d87","repo":"phacility/phabricator","slug":"when-creating-a-new-almanac-interface-via-the-cond","errorCode":null,"errorMessage":"When creating a new Almanac interface via the Conduit API, you must provide a \"device\" transaction to select a device.","messagePattern":"When creating a new Almanac interface via the Conduit API, you must provide a \"device\" transaction to select a device\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/almanac/editor/AlmanacInterfaceEditEngine.php","lineNumber":69,"sourceCode":"  }\n\n  protected function newEditableObjectForDocumentation() {\n    $this->setDevice(new AlmanacDevice());\n    return $this->newEditableObject();\n  }\n\n  protected function newEditableObjectFromConduit(array $raw_xactions) {\n    $device_phid = null;\n    foreach ($raw_xactions as $raw_xaction) {\n      if ($raw_xaction['type'] !== 'device') {\n        continue;\n      }\n\n      $device_phid = $raw_xaction['value'];\n    }\n\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 '.","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/almanac/editor/AlmanacInterfaceEditEngine.php#L51-L87","documentation":"Thrown by PhabricatorRepository::assertValidRepositorySlug() when a repository short name exceeds 64 characters. Short names appear in clone URIs and filesystem paths, so Phabricator caps them at 64 characters to stay within filesystem and ergonomic limits. It is raised from the short-name transaction path (UI or 'repository.edit') when the proposed value is too long.","triggerScenarios":"Setting a repository short name longer than 64 characters via repository.edit or the web UI: the strlen($slug) > 64 check at PhabricatorRepository.php:378 throws, interpolating the offending name.","commonSituations":"Auto-generating slugs from long project or team names; importing repositories whose directory names exceed the limit; concatenating group prefixes plus repo names in provisioning scripts.","solutions":["Shorten the short name to 64 characters or fewer (keep the descriptive parts, drop redundant prefixes).","In provisioning code, truncate or hash overly long generated names, e.g. substr($name, 0, 64).","Validate with PhabricatorRepository::isValidRepositorySlug() before submitting the transaction."],"exampleFix":"// before\n$slug = 'infrastructure-team-monitoring-agent-deployment-pipelines-and-tooling-config'; // > 64 chars\n\n// after\n$slug = 'infra-monitoring-agent-deploy-tooling'; // <= 64 chars","handlingStrategy":"type-guard","validationCode":"if (strlen($slug) > 64) { $slug = substr($slug, 0, 64); /* then re-check trailing separator */ }","typeGuard":"function isValidShortName($slug) {\n  return PhabricatorRepository::isValidRepositorySlug((string)$slug);\n}","tryCatchPattern":"try {\n  PhabricatorRepository::assertValidRepositorySlug($slug);\n} catch (Exception $ex) {\n  // handle over-long name: reject or truncate-and-revalidate\n}","preventionTips":["Cap generated slugs at 64 characters during provisioning.","Trim separators after truncation so the result still passes validation."],"tags":["phabricator","php","validation","repository-shortname","length-limit"],"backgroundTag":"max-length-exceeded","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}