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) and objects which do not exist (%s).

What it means

PhabricatorObjectListQuery resolves a list of object references (monikers/PHIDs/usernames) for fields such as Differential reviewers or subscribers. When partial results are disallowed (getAllowPartialResults() false, the default) and some references resolved to objects of the wrong type ($invalid) while others resolved to nothing ($missing), it throws DifferentialFieldParseException naming both sets. This fires while parsing/validating a Differential field value before it is saved.

Source

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

    // revision author does not have permission to see are added by Herald
    // rules. Any actual edits will be checked later: users are not allowed
    // to add new reviewers they can't see, but they can touch a field which
    // contains them.
    foreach ($missing as $key => $value) {
      if (isset($allowed[phid_get_type($value)])) {
        unset($missing[$key]);
        $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)));
      }

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Remove or correct both the wrong-type entries and the nonexistent entries named in the message
  2. Use only references valid for that field - usernames, @usernames, or PHID-USER-* for user lists
  3. Programmatic callers that can tolerate drops should call setAllowPartialResults(true) on the query

Example fix

// before: reviewers = "alice, D123, charlie-noexist"
// after: reviewers = "alice"  // drop the revision monogram and the unknown username
Defensive patterns

Strategy: validation

Validate before calling

// Dry-run the list resolution before saving the field
$check = id(new PhabricatorObjectListQuery())
  ->setViewer($viewer)
  ->setObjectList($raw_value)
  ->setAllowedTypes(array('PHID-USER'))
  ->execute();
if (count($check) !== count(explode(',', $raw_value))) {
  // some refs are wrong-type or nonexistent; show a field error instead of saving
}

Try / catch

try {
  $result = $list_query->execute();
} catch (DifferentialFieldParseException $ex) {
  // surface $ex->getMessage() as a validation error on the form field
  $field_error = $ex->getMessage();
}

Prevention

When it happens

Trigger: Setting Reviewers to something like 'alice, D123, bob-notexistent' where D123 is a revision (wrong type) and the last entry matches no user; custom fields built on PhabricatorObjectListQuery with a single expected object type receiving mixed input; API clients sending PHID-TASK-/PHID-DIFF- values into a users-only field.

Common situations: Pasting comma-separated lists where a monogram or PHID slips in; typos in usernames; renamed/deleted users in saved templates; migration scripts replaying old field values.

Related errors


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