phacility/phabricator · error · Exception

Field "slug" must be non-empty.

Error message

Field "slug" must be non-empty.

What it means

The phriction.info Conduit method requires the slug field to identify the document whose metadata will be returned; execute() rejects a null or zero-length slug up front. It is a plain Exception, so the client sees a generic Conduit failure.

Source

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

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

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

  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.'));
    }

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

    return $this->buildDocumentInfoDictionary($document);
  }

}

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Pass a non-empty document slug in the call parameters
  2. Guard the slug before the call when it originates from user input or external data
  3. Log the offending parameter when the error occurs so the bad caller is identifiable
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

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

Common situations: Lookup helpers that accept whatever slug string the caller passed, including blanks; ingestion pipelines where a row's path field is empty.

Related errors


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