phacility/phabricator · error · DifferentialFieldParseException

The objects you have listed include objects of the wrong typ

Error message

The objects you have listed include objects of the wrong type (%s).

What it means

Variant of the PhabricatorObjectListQuery failure where every reference resolved, but at least one resolved to an object whose type does not match the field's expected types ($invalid is non-empty, $missing is empty). Partial results are disallowed, so parsing aborts with DifferentialFieldParseException listing the wrong-type references. Typical case: a task or revision monogram/PHID in a field that only accepts users.

Source

Thrown at src/applications/phid/query/PhabricatorObjectListQuery.php:185

        $result[$key] = $value;
      }
    }

    // NOTE: We could couple this less tightly with Differential, but it is
    // currently the only thing that uses it, and we'd have to add a lot of
    // extra API to loosen this. It's not clear that this will be useful
    // elsewhere any time soon, so let's cross that bridge when we come to it.

    if (!$this->getAllowPartialResults()) {
      if ($invalid && $missing) {
        throw new DifferentialFieldParseException(
          pht(
            'The objects you have listed include objects of the wrong '.
            'type (%s) and objects which do not exist (%s).',
            implode(', ', $invalid),
            implode(', ', $missing)));
      } else if ($invalid) {
        throw new DifferentialFieldParseException(
          pht(
            'The objects you have listed include objects of the wrong '.
            'type (%s).',
            implode(', ', $invalid)));
      } else if ($missing) {
        throw new DifferentialFieldParseException(
          pht(
            'The objects you have listed include objects which do not '.
            'exist (%s).',
            implode(', ', $missing)));
      }
    }

    if ($suffixes) {
      foreach ($result as $key => $phid) {
        $result[$key] = array(
          'phid' => $phid,
          'suffixes' => idx($suffix_map, $key, array()),

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Remove the wrong-type entries listed in the message from the field value
  2. Double-check each monogram prefix (T=task, D=revision, PROJ=project, @/PHID-USER=user)
  3. If your custom field legitimately accepts mixed types, pass all valid types to withTypes() when building the query

Example fix

// before
Reviewers: alice, T123
// after
Reviewers: alice  // tasks are not valid reviewers; link them in the description instead
Defensive patterns

Strategy: validation

Validate before calling

// Verify every reference resolves to an allowed type before use
$types = array('PHID-USER');
$objects = id(new PhabricatorObjectQuery())
  ->setViewer($viewer)
  ->withNames($refs)
  ->execute();
foreach ($objects as $object) {
  if (!in_array($object->getPHIDType(), $types, true)) {
    // wrong type: reject with a precise message before the editor runs
  }
}

Try / catch

try {
  $phids = id(new PhabricatorObjectListQuery())
    ->setAllowedTypes(array('PHID-USER'))
    ->setObjectList($list)
    ->execute();
} catch (DifferentialFieldParseException $ex) {
  // wrong-type entries are named in the message; render as field validation error
}

Prevention

When it happens

Trigger: Reviewers field containing 'T123' or 'PHID-TASK-xxxx'; a subscribers-style custom field restricted to projects receiving a user PHID; drag-pasted monograms from a search results page into a user field.

Common situations: Users pasting object names from other applications; integrations mapping external IDs to the wrong PHID type; field configuration changed to a narrower type after content existed.

Related errors


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