phacility/phabricator · warning · PhutilSearchQueryCompilerSyntaxException

Unknown search function "%s". Supported functions are: %s. (

Error message

Unknown search function "%s". Supported functions are: %s. (To search for a term containing a colon, surround the term in double quotes.)

What it means

PhabricatorFerretEngine::getFieldForFunction() maps a function prefix in a search query (the part before ':', e.g. 'title:' in `title:ship`) either to a real Ferret field or to a registered FerretSearchFunction. The raw name is normalized and looked up in the set of installed functions; an unknown prefix throws PhutilSearchQueryCompilerSyntaxException advising you to quote terms containing colons. This is the gate that decides whether `foo:bar` is a field search or literal text.

Source

Thrown at src/applications/search/ferret/PhabricatorFerretEngine.php:35

  public function getObjectTypeRelevance() {
    return 1000;
  }

  final public function getFunctionForName($raw_name) {
    if (isset($this->fieldMap[$raw_name])) {
      return $this->fieldMap[$raw_name];
    }

    $normalized_name =
      FerretSearchFunction::getNormalizedFunctionName($raw_name);

    if ($this->ferretFunctions === null) {
      $functions = FerretSearchFunction::newFerretSearchFunctions();
      $this->ferretFunctions = $functions;
    }

    if (!isset($this->ferretFunctions[$normalized_name])) {
      throw new PhutilSearchQueryCompilerSyntaxException(
        pht(
          'Unknown search function "%s". Supported functions are: %s. '.
          '(To search for a term containing a colon, surround the term '.
          'in double quotes.)',
          $raw_name,
          implode(', ', array_keys($this->ferretFunctions))));
    }

    $function = $this->ferretFunctions[$normalized_name];
    $this->fieldMap[$raw_name] = $function;

    return $this->fieldMap[$raw_name];
  }

  public function newStemmer() {
    return new PhutilSearchStemmer();
  }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Wrap terms containing colons in double quotes: search `"12:30"`, `"C:\temp"`, `"http://example.com"` - the message itself states this remedy.
  2. Use only field names that application's engine defines (check the app's search help/advanced query docs for the field list).
  3. For custom extensions, register the new function via FerretSearchFunction so it appears in the supported list printed in the error.
  4. Strip or transform user text before embedding into saved queries if you generate them programmatically (quote anything with ':').

Example fix

// before: colon parsed as function separator
throw new Exception('search term: '.$user_input);

// after: quote input that may contain colons
function quote_term($t) { return strpos($t, ':') !== false ? '"'.$t.'"' : $t; }
$parts[] = quote_term($user_input);
Defensive patterns

Strategy: validation

Validate before calling

// Quote anything with a colon before it reaches the compiler
$term = (strpos($term, ':') !== false) ? '"'.$term.'"' : $term;

Type guard

function isKnownFunctionOrQuoted($engine, $term) { if ($term[0] === '"') return true; $parts = explode(':', $term, 2); if (count($parts) < 2) return true; try { $engine->getFieldForFunction($parts[0]); return true; } catch (PhutilSearchQueryCompilerSyntaxException $ex) { return false; } }

Try / catch

try {
  $compiled = $compiler->compileQuery($field, $query);
} catch (PhutilSearchQueryCompilerSyntaxException $ex) {
  // hint the standard remedy and keep user input intact
  $errors[] = $ex->getMessage(); // already contains the quoting advice + valid function list
}

Prevention

When it happens

Trigger: Any search box or Conduit query containing `prefix:term` where prefix is neither a field of that application's Ferret engine (title, body, project, ...) nor a registered function (e.g. 'cat', 'sub', 'exact' style functions registered by extensions): searching for a time '12:30', a Windows path 'C:\temp', or 'http://...' URLs without quotes.

Common situations: Users pasting URLs, timestamps, file paths, or RFC headers into Maniphest/Differential/global search; custom applications adding new function names that other apps' engines do not know; typos like 'titel:ship'; queries shared between applications where a field exists in one app's engine but not another's.

Related errors


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