phacility/phabricator · error · Exception
Version name "%s" is not valid: version names must not be mo
Error message
Version name "%s" is not valid: version names must not be more than %s characters long.
What it means
Thrown by PhabricatorPackagesVersion::assertValidVersionName() when the version name exceeds 64 UTF-8 characters. Even though version strings like '1.0.3-beta.2+build.2013-01-15' can get long, Phabricator caps them at 64 characters, counted per glyph via phutil_utf8_strlen().
Source
Thrown at src/applications/packages/storage/PhabricatorPackagesVersion.php:72
return $this;
}
public function getPackage() {
return $this->assertAttached($this->package);
}
public static function assertValidVersionName($value) {
$length = phutil_utf8_strlen($value);
if (!$length) {
throw new Exception(
pht(
'Version name "%s" is not valid: version names are required.',
$value));
}
$max_length = 64;
if ($length > $max_length) {
throw new Exception(
pht(
'Version name "%s" is not valid: version names must not be '.
'more than %s characters long.',
$value,
new PhutilNumber($max_length)));
}
if (!preg_match('/^[A-Za-z0-9.-]+\z/', $value)) {
throw new Exception(
pht(
'Version name "%s" is not valid: version names may only contain '.
'latin letters, digits, periods, and hyphens.',
$value));
}
if (preg_match('/^[.-]|[.-]$/', $value)) {
throw new Exception(
pht(View on GitHub (pinned to 5720a38cfe)
Solutions
- Shorten the version name to 64 characters or fewer.
- Move volatile build metadata (SHAs, timestamps) into the version description or a separate field rather than the name.
- Truncate generated names with PhutilUTF8StringTruncator before validation.
Example fix
// before
$name = sprintf('%s+build.%s.%s', $tag, $date, $commit_sha); // 70+ chars
// after
$name = sprintf('%s+build.%s', $tag, substr($commit_sha, 0, 7));
if (phutil_utf8_strlen($name) > 64) {
$name = id(new PhutilUTF8StringTruncator())
->setMaximumGlyphs(64)
->truncateString($name);
}
PhabricatorPackagesVersion::assertValidVersionName($name); Defensive patterns
Strategy: validation
Validate before calling
$max = 64;
if (phutil_utf8_strlen($name) > $max) {
$name = id(new PhutilUTF8StringTruncator())
->setMaximumGlyphs($max)
->truncateString($name);
}
PhabricatorPackagesVersion::assertValidVersionName($name); Type guard
function is_valid_version_name_length($name) {
return is_string($name) && phutil_utf8_strlen($name) <= 64;
} Try / catch
try {
PhabricatorPackagesVersion::assertValidVersionName($name);
} catch (Exception $ex) {
$errors[] = $ex->getMessage();
} Prevention
- Keep build metadata (SHAs, timestamps) out of the version name; use shorter forms.
- Cap generated version labels at 64 glyphs before saving.
- Use phutil_utf8_strlen() for the length check.
When it happens
Trigger: Creating a package version whose auto-generated or semver-plus-build-metadata name exceeds 64 characters, e.g. concatenating tag, channel, timestamp, and commit hash into the version name.
Common situations: CI scripts that build version labels from commit SHAs and timestamps; importing release streams that embed full build identifiers in the tag.
Related errors
- Publisher name "%s" is not valid: publisher names must not b
- Publisher key "%s" is not valid: publisher keys must not be
- Version name "%s" is not valid: version names are required.
- Version name "%s" is not valid: version names may only conta
- Version name "%s" is not valid: version names may not start
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/68f18155cc71774c.
Report an issue: GitHub.