{"record":{"id":"5d4cf240dd1018a7","repo":"phacility/phabricator","slug":"almanac-service-device-property-network-and-nam-5d4cf2","errorCode":null,"errorMessage":"Almanac service, device, property, network and namespace names may not be more than 100 characters long.","messagePattern":"Almanac service, device, property, network and namespace names may not be more than 100 characters long\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/almanac/util/AlmanacNames.php","lineNumber":14,"sourceCode":"<?php\n\nfinal class AlmanacNames extends Phobject {\n\n  public static function validateName($name) {\n    if (strlen($name) < 3) {\n      throw new Exception(\n        pht(\n          'Almanac service, device, property, network and namespace names '.\n          'must be at least 3 characters long.'));\n    }\n\n    if (strlen($name) > 100) {\n      throw new Exception(\n        pht(\n          'Almanac service, device, property, network and namespace names '.\n          'may not be more than 100 characters long.'));\n    }\n\n    if (!preg_match('/^[a-z0-9.-]+\\z/', $name)) {\n      throw new Exception(\n        pht(\n          'Almanac service, device, property, network and namespace names '.\n          'may only contain lowercase letters, numbers, hyphens, and '.\n          'periods.'));\n    }\n\n    if (preg_match('/(^|\\\\.)\\d+(\\z|\\\\.)/', $name)) {\n      throw new Exception(\n        pht(\n          'Almanac service, device, network, property and namespace names '.\n          'may not have any segments containing only digits.'));","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/almanac/util/AlmanacNames.php#L1-L32","documentation":"Second rule of AlmanacNames::validateName(): names may not exceed 100 characters. The cap keeps names usable in DNS-like contexts, database indexes, and UI display; longer inputs are rejected before any record is created.","triggerScenarios":"Creating or renaming a service/device/network/property/namespace with strlen($name) > 100, typically machine-generated names (full hostnames, auto-built property keys) pasted or templated into the name field.","commonSituations":"Automation constructing names from concatenated templates ('team-' + env + region + role + index...) that overshoot 100 chars; importing FQDNs as device names.","solutions":["Shorten the name below 101 characters, e.g. use the short hostname instead of the full FQDN.","Fix the template that assembles names in your provisioning code and add a length check before calling the API.","Move descriptive detail into Almanac properties or the description field rather than the name."],"exampleFix":"// before\n$name = 'repo-node-eu-west-1-'.implode('-', $longTagList); // 120+ chars -> throws\n\n// after\n$name = 'repo-euw1-007'; // short, still unique","handlingStrategy":"validation","validationCode":"if (strlen($name) > 100) {\n  throw new Exception('Almanac names must be at most 100 characters (got '.strlen($name).').');\n}\nAlmanacNames::validateName($name);","typeGuard":"function isWithinAlmanacNameLengthLimit($name) {\n  return strlen($name) <= 100;\n}","tryCatchPattern":"try {\n  AlmanacNames::validateName($name);\n} catch (Exception $ex) {\n  if (preg_match('/more than 100 characters/', $ex->getMessage())) {\n    $name = substr($name, 0, 100); // then re-run ALL rules before retrying\n    AlmanacNames::validateName($name);\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["Enforce a max length in name-generating templates, well under 100 chars.","Store long descriptions in properties/description fields, not in the name.","Add a unit test over your name builder asserting strlen < 101."],"tags":["almanac","validation","naming","phabricator"],"backgroundTag":"identifier-validation-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}