phacility/phabricator · error · Exception

Version name " " is not valid: version names must not be…

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().

Solutions

  1. Shorten the version name to 64 characters or fewer.
  2. Move volatile build metadata (SHAs, timestamps) into the version description or a separate field rather than the name.
  3. 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

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


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/68f18155cc71774c. Report an issue: GitHub.

Appendix: 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)