{"record":{"id":"15dd47448f22f803","repo":"phacility/phabricator","slug":"almanac-service-device-network-property-and-nam","errorCode":null,"errorMessage":"Almanac service, device, network, property and namespace names may not have any segments containing only digits.","messagePattern":"Almanac service, device, network, property and namespace names may not have any segments containing only digits\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/almanac/util/AlmanacNames.php","lineNumber":29,"sourceCode":"    }\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.'));\n    }\n\n    if (preg_match('/\\.\\./', $name)) {\n      throw new Exception(\n        pht(\n          'Almanac service, device, property, network and namespace names '.\n          'may not contain multiple consecutive periods.'));\n    }\n\n    if (preg_match('/\\\\.-|-\\\\./', $name)) {\n      throw new Exception(\n        pht(\n          'Almanac service, device, property, network and namespace names '.\n          'may not contain hyphens adjacent to periods.'));\n    }","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/almanac/util/AlmanacNames.php#L11-L47","documentation":"Fourth rule of AlmanacNames::validateName(): no dot-separated segment may consist solely of digits, enforced by /(^|\\.)\\d+(\\z|\\.)/. This prevents purely numeric labels, which are ambiguous with numeric IDs and invalid as DNS labels in many resolvers.","triggerScenarios":"Names like 'db.01.host', 'cluster.2', or '123' where any segment between dots (including the whole name) is all digits.","commonSituations":"Auto-numbering schemes that zero-pad segments ('node.001'); names built by joining numeric shard IDs with dots.","solutions":["Prefix numeric segments with a letter: 'db.01.host' -> 'db.n01.host', 'cluster.2' -> 'cluster.v2'.","Adjust generators to always emit at least one letter per segment.","Remember a fully numeric name also trips this rule, not just inner segments."],"exampleFix":"// before\n$service->setName('cluster.2'); // throws: digit-only segment\n\n// after\n$service->setName('cluster.v2');","handlingStrategy":"validation","validationCode":"if (preg_match('/(^|\\.)\\d+(\\z|\\.)/', $name)) {\n  throw new Exception('No dot-separated segment may be all digits.');\n}","typeGuard":"function hasNoDigitOnlySegments($name) {\n  foreach (explode('.', $name) as $segment) {\n    if ($segment !== '' && ctype_digit($segment)) {\n      return false;\n    }\n  }\n  return true;\n}","tryCatchPattern":"try {\n  AlmanacNames::validateName($name);\n} catch (Exception $ex) {\n  if (preg_match('/segments containing only digits/', $ex->getMessage())) {\n    // prefix numeric segments, e.g. 'cluster.2' -> 'cluster.v2', then re-validate\n  } else {\n    throw $ex;\n  }\n}","preventionTips":["Name generators must inject a letter into every numeric segment (v2, n01, s3).","Test generated names against the full AlmanacNames rule set in CI.","Remember a wholly numeric name is also rejected by this rule."],"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"}