phacility/phabricator · error · Exception
When creating a new Almanac service via the Conduit API, you
Error message
When creating a new Almanac service via the Conduit API, you must provide a "type" transaction to select a type.
What it means
Thrown by PhabricatorRepository::assertValidRepositorySlug() when a repository short name contains multiple consecutive underscores, hyphens, or periods ('__', '--', or '..'). Runs of separators are rejected because '..' enables path-traversal interpretations and repeated separators make URIs ambiguous; Phabricator requires single separators between name words. Enforced by the preg_match('/__|--|\.\./', $slug) check in the short-name transaction path.
Source
Thrown at src/applications/almanac/editor/AlmanacServiceEditEngine.php:55
}
protected function newEditableObject() {
$service_type = $this->getServiceType();
return AlmanacService::initializeNewService($service_type);
}
protected function newEditableObjectFromConduit(array $raw_xactions) {
$type = null;
foreach ($raw_xactions as $raw_xaction) {
if ($raw_xaction['type'] !== 'type') {
continue;
}
$type = $raw_xaction['value'];
}
if ($type === null) {
throw new Exception(
pht(
'When creating a new Almanac service via the Conduit API, you '.
'must provide a "type" transaction to select a type.'));
}
$map = AlmanacServiceType::getAllServiceTypes();
if (!isset($map[$type])) {
throw new Exception(
pht(
'Service type "%s" is unrecognized. Valid types are: %s.',
$type,
implode(', ', array_keys($map))));
}
$this->setServiceType($type);
return $this->newEditableObject();
}View on GitHub (pinned to 5720a38cfe)
Solutions
- Collapse separator runs to a single character in generated names: preg_replace('/([._-])\1+/', '$1', $slug) or replace invalid runs with one hyphen ('/[^a-zA-Z0-9._-]+/' with '-').
- Fix the source name manually ('team--utils' -> 'team-utils').
- Run PhabricatorRepository::isValidRepositorySlug() on generated names before applying them.
Example fix
// before
$slug = preg_replace('/[^a-zA-Z0-9._-]/', '-', 'team utils'); // 'team--utils'
// after
$slug = preg_replace('/[^a-zA-Z0-9._-]+/', '-', 'team utils'); // 'team-utils' Defensive patterns
Strategy: type-guard
Validate before calling
$slug = preg_replace('/([._-]){2,}/', '$1', $slug); // collapse '__', '--', '..' Type guard
function isValidShortName($slug) {
return PhabricatorRepository::isValidRepositorySlug((string)$slug);
} Try / catch
try {
PhabricatorRepository::assertValidRepositorySlug($slug);
} catch (Exception $ex) {
// collapse separator runs and revalidate, or reject
} Prevention
- Replace invalid-character RUNS ('/[^a-zA-Z0-9._-]+/') with a single hyphen, not per-character.
- Reject '..' explicitly in upstream name sources; it doubles as a path-traversal guard.
When it happens
Trigger: Setting a short name like 'team--utils' or 'repo..name': the separator-run regex at PhabricatorRepository.php:411 matches and throws with the offending name.
Common situations: Naive sanitizers that replace each invalid character individually with '-', turning 'a b' into 'a--b'; names that literally contain '..' copied from paths; merging prefix and suffix strings that both end/start with a separator.
Related errors
- Service "%s" is unrecognized, restricted, or you do not have
- When creating a new Almanac interface via the Conduit API, y
- Device "%s" is unrecognized, restricted, or you do not have
- Interfaces must have a unique combination of network, device
- Another namespace with this name already exists. Each namesp
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/9bd36b1aa6043c6f.
Report an issue: GitHub.