{"record":{"id":"6276b01f5ab5f417","repo":"phacility/phabricator","slug":"publisher-key-s-is-not-valid-publisher-keys-ma","errorCode":null,"errorMessage":"Publisher key \"%s\" is not valid: publisher keys may only contain lowercase latin letters.","messagePattern":"Publisher key \"(.+?)\" is not valid: publisher keys may only contain lowercase latin letters\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/packages/storage/PhabricatorPackagesPublisher.php","lineNumber":97,"sourceCode":"    if (!$length) {\n      throw new Exception(\n        pht(\n          'Publisher key \"%s\" is not valid: publisher keys are required.',\n          $value));\n    }\n\n    $max_length = 64;\n    if ($length > $max_length) {\n      throw new Exception(\n        pht(\n          'Publisher key \"%s\" is not valid: publisher keys must not be '.\n          'more than %s characters long.',\n          $value,\n          new PhutilNumber($max_length)));\n    }\n\n    if (!preg_match('/^[a-z]+\\z/', $value)) {\n      throw new Exception(\n        pht(\n          'Publisher key \"%s\" is not valid: publisher keys may only contain '.\n          'lowercase latin letters.',\n          $value));\n    }\n  }\n\n\n/* -(  PhabricatorSubscribableInterface  )----------------------------------- */\n\n\n  public function isAutomaticallySubscribed($phid) {\n    return false;\n  }\n\n\n/* -(  Policy Interface  )--------------------------------------------------- */\n","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/packages/storage/PhabricatorPackagesPublisher.php#L79-L115","documentation":"Thrown by PhabricatorPackagesPublisher::assertValidPublisherKey() when the key contains anything other than pure lowercase latin letters (enforced by /^[a-z]+\\z/). Because keys are embedded directly in URIs and used as literal match keys, uppercase letters, digits, underscores, hyphens, spaces, and multibyte characters are all rejected.","triggerScenarios":"Submitting a key such as 'Acme_Corp', 'acme1', 'acme-corp', or 'acme' through the publisher create/edit form or editor transactions; any key that survived a normalization step that only lowercased part of the string.","commonSituations":"Auto-generating keys from display names without stripping non-letters; copying identifiers from external registries that allow digits and dashes (GitHub org names, npm scopes); i18n names with accented characters.","solutions":["Normalize the key: strtolower() it, then strip everything matching /[^a-z]+/.","If digits or separators are essential to your scheme, move them into the publisher name and keep the key strictly alphabetic.","Validate against ^[a-z]+$ client-side before submitting the form."],"exampleFix":"// before\n$key = 'Acme_Corp2020';\n\n// after\n$key = preg_replace('/[^a-z]+/', '', strtolower('Acme_Corp2020'));\n// $key is now 'acmecorp'\nPhabricatorPackagesPublisher::assertValidPublisherKey($key);","handlingStrategy":"validation","validationCode":"$key = preg_replace('/[^a-z]+/', '', strtolower($raw_key));\nif (!preg_match('/^[a-z]+\\z/', $key)) {\n  // still invalid (e.g. empty after strip) - reject with a form error\n}\nPhabricatorPackagesPublisher::assertValidPublisherKey($key);","typeGuard":"function is_valid_publisher_key($key) {\n  return is_string($key) && preg_match('/^[a-z]+\\z/', $key) === 1;\n}","tryCatchPattern":"try {\n  PhabricatorPackagesPublisher::assertValidPublisherKey($key);\n} catch (Exception $ex) {\n  $errors[] = $ex->getMessage();\n}","preventionTips":["Generate keys with strtolower() plus a [^a-z] strip in one normalization step.","Never copy external identifiers (org names, scopes) into keys without normalization.","Add a client-side regex hint ^[a-z]+$ next to the key field."],"tags":["phabricator","packages","publisher","slug","validation"],"backgroundTag":"identifier-format-validation","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}