phacility/phabricator · error · Exception

Field "slug" must be non-empty.

Error message

Field "slug" must be non-empty.

What it means

The phriction.history Conduit method requires the slug field to locate the document whose content versions will be listed; execute() rejects a null or zero-length slug before any query runs. It surfaces to clients as a generic Conduit error because a plain Exception is used.

Source

Thrown at src/applications/phriction/conduit/PhrictionHistoryConduitAPIMethod.php:42

    return array(
      'slug' => 'required string',
    );
  }

  protected function defineReturnType() {
    return 'nonempty list';
  }

  protected function defineErrorTypes() {
    return array(
      'ERR-BAD-DOCUMENT' => pht('No such document exists.'),
    );
  }

  protected function execute(ConduitAPIRequest $request) {
    $slug = $request->getValue('slug');
    if ($slug === null || !strlen($slug)) {
      throw new Exception(pht('Field "slug" must be non-empty.'));
    }

    $doc = id(new PhrictionDocumentQuery())
      ->setViewer($request->getUser())
      ->withSlugs(array(PhabricatorSlug::normalize($slug)))
      ->executeOne();
    if (!$doc) {
      throw new ConduitException('ERR-BAD-DOCUMENT');
    }

    $content = id(new PhrictionContent())->loadAllWhere(
      'documentID = %d ORDER BY version DESC',
      $doc->getID());

    $results = array();
    foreach ($content as $version) {
      $results[] = $this->buildDocumentContentDictionary(
        $doc,

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pass a non-empty document slug in the call parameters
  2. Filter or validate slug lists before iterating them into phriction.history calls
  3. Fall back to phriction.info on the same slug to verify resolvability when debugging
Defensive patterns

Strategy: validation

Validate before calling

$slug = (string)idx($params, 'slug', '');
if ($slug === '') {
  throw new InvalidArgumentException('phriction.history: slug must be non-empty');
}
$result = $client->callMethodSynchronous('phriction.history', $params);

Prevention

When it happens

Trigger: Calling conduit method phriction.history with slug omitted, null, or the empty string.

Common situations: History-export scripts where the slug list contains blanks; iterating over rows from another system where some paths failed to map to slugs.

Related errors


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