{"record":{"id":"14b5791035ce4297","repo":"phacility/phabricator","slug":"the-objects-you-have-listed-include-objects-of-the-14b579","errorCode":null,"errorMessage":"The objects you have listed include objects of the wrong type (%s).","messagePattern":"The objects you have listed include objects of the wrong type \\((.+?)\\)\\.","errorType":"validation","errorClass":"DifferentialFieldParseException","httpStatus":null,"severity":"error","filePath":"src/applications/phid/query/PhabricatorObjectListQuery.php","lineNumber":185,"sourceCode":"        $result[$key] = $value;\n      }\n    }\n\n    // NOTE: We could couple this less tightly with Differential, but it is\n    // currently the only thing that uses it, and we'd have to add a lot of\n    // extra API to loosen this. It's not clear that this will be useful\n    // elsewhere any time soon, so let's cross that bridge when we come to it.\n\n    if (!$this->getAllowPartialResults()) {\n      if ($invalid && $missing) {\n        throw new DifferentialFieldParseException(\n          pht(\n            'The objects you have listed include objects of the wrong '.\n            'type (%s) and objects which do not exist (%s).',\n            implode(', ', $invalid),\n            implode(', ', $missing)));\n      } else if ($invalid) {\n        throw new DifferentialFieldParseException(\n          pht(\n            'The objects you have listed include objects of the wrong '.\n            'type (%s).',\n            implode(', ', $invalid)));\n      } else if ($missing) {\n        throw new DifferentialFieldParseException(\n          pht(\n            'The objects you have listed include objects which do not '.\n            'exist (%s).',\n            implode(', ', $missing)));\n      }\n    }\n\n    if ($suffixes) {\n      foreach ($result as $key => $phid) {\n        $result[$key] = array(\n          'phid' => $phid,\n          'suffixes' => idx($suffix_map, $key, array()),","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/phid/query/PhabricatorObjectListQuery.php#L167-L203","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the wrong-type entries listed in the message from the field value","Double-check each monogram prefix (T=task, D=revision, PROJ=project, @/PHID-USER=user)","If your custom field legitimately accepts mixed types, pass all valid types to withTypes() when building the query"],"exampleFix":"// before\nReviewers: alice, T123\n// after\nReviewers: alice  // tasks are not valid reviewers; link them in the description instead","handlingStrategy":"validation","validationCode":"// Verify every reference resolves to an allowed type before use\n$types = array('PHID-USER');\n$objects = id(new PhabricatorObjectQuery())\n  ->setViewer($viewer)\n  ->withNames($refs)\n  ->execute();\nforeach ($objects as $object) {\n  if (!in_array($object->getPHIDType(), $types, true)) {\n    // wrong type: reject with a precise message before the editor runs\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  $phids = id(new PhabricatorObjectListQuery())\n    ->setAllowedTypes(array('PHID-USER'))\n    ->setObjectList($list)\n    ->execute();\n} catch (DifferentialFieldParseException $ex) {\n  // wrong-type entries are named in the message; render as field validation error\n}","preventionTips":["Restrict inputs to monikers whose type matches the field (users for reviewers)","Pre-resolve references and filter by PHID type before saving","Educate users that monograms like T123 are not valid reviewers"],"tags":["phabricator","differential","field-validation","object-list","wrong-type"],"backgroundTag":"reference-validation-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}