phacility/phabricator · error · Exception
Publisher name "%s" is not valid: publisher names must not b
Error message
Publisher name "%s" is not valid: publisher names must not be more than %s characters long.
What it means
Thrown by PhabricatorPackagesPublisher::assertValidPublisherName() when validating the display name of a Packages publisher. Publisher names are free-form text but must be non-empty and at most 64 UTF-8 characters long, measured with phutil_utf8_strlen() so multi-byte glyphs count as one character each. The publisher editor runs this assertion before applying transactions, so an over-long name is rejected before it reaches storage.
Source
Thrown at src/applications/packages/storage/PhabricatorPackagesPublisher.php:68
}
public function getURI() {
$publisher_key = $this->getPublisherKey();
return "/package/{$publisher_key}/";
}
public static function assertValidPublisherName($value) {
$length = phutil_utf8_strlen($value);
if (!$length) {
throw new Exception(
pht(
'Publisher name "%s" is not valid: publisher names are required.',
$value));
}
$max_length = 64;
if ($length > $max_length) {
throw new Exception(
pht(
'Publisher name "%s" is not valid: publisher names must not be '.
'more than %s characters long.',
$value,
new PhutilNumber($max_length)));
}
}
public static function assertValidPublisherKey($value) {
$length = phutil_utf8_strlen($value);
if (!$length) {
throw new Exception(
pht(
'Publisher key "%s" is not valid: publisher keys are required.',
$value));
}
$max_length = 64;View on GitHub (pinned to 5720a38cfe)
Solutions
- Shorten the publisher name to 64 characters or fewer (count multi-byte characters as one).
- If the full long text matters, move it into the publisher description field, which has no such tight limit.
- When importing, truncate programmatically with PhutilUTF8StringTruncator before feeding the editor.
- Add a client-side length check in the form so users get a friendly message instead of a raw exception.
Example fix
// before
$xactions[] = id(new PhabricatorPackagesPublisherTransaction())
->setTransactionType(
PhabricatorPackagesPublisherNameTransaction::TRANSACTIONTYPE)
->setNewValue($name); // $name is 70 characters long
// after
if (phutil_utf8_strlen($name) > 64) {
$name = id(new PhutilUTF8StringTruncator())
->setMaximumGlyphs(64)
->truncateString($name);
}
$xactions[] = id(new PhabricatorPackagesPublisherTransaction())
->setTransactionType(
PhabricatorPackagesPublisherNameTransaction::TRANSACTIONTYPE)
->setNewValue($name); Defensive patterns
Strategy: validation
Validate before calling
$max = 64;
if (!is_string($name) || !phutil_utf8_strlen($name)) {
// reject before saving
} elseif (phutil_utf8_strlen($name) > $max) {
$name = id(new PhutilUTF8StringTruncator())
->setMaximumGlyphs($max)
->truncateString($name);
}
PhabricatorPackagesPublisher::assertValidPublisherName($name); Type guard
function is_valid_publisher_name($name) {
return is_string($name)
&& phutil_utf8_strlen($name) > 0
&& phutil_utf8_strlen($name) <= 64;
} Try / catch
try {
PhabricatorPackagesPublisher::assertValidPublisherName($name);
} catch (Exception $ex) {
$errors[] = $ex->getMessage(); // surface as a form validation error
} Prevention
- Cap the publisher name input at 64 characters in the form's maxlength/UX.
- Measure length with phutil_utf8_strlen(), never strlen(), before saving.
- Run assertValidPublisherName() on all imported data before applying transactions.
When it happens
Trigger: Creating or editing a publisher via PhabricatorPackagesPublisherEditor (web form at Packages > Create Publisher, HTTP API, or seeding script) with a name whose UTF-8 length exceeds 64, e.g. a 70-character company-plus-product title.
Common situations: Bulk-importing publishers from an external registry (npm scopes, Maven group ids, long vendor names) that imposes no length cap; migration scripts copying display names verbatim; generated test fixtures with long strings.
Related errors
- Publisher key "%s" is not valid: publisher keys must not be
- Publisher key "%s" is not valid: publisher keys are required
- Publisher key "%s" is not valid: publisher keys may only con
- Version name "%s" is not valid: version names must not be mo
- Version name "%s" is not valid: version names are required.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/6c19c71941105004.
Report an issue: GitHub.