{"record":{"id":"8c62febd62a61110","repo":"phacility/phabricator","slug":"edge-transactions-must-have-phids-or-edge-specs-as","errorCode":null,"errorMessage":"Edge transactions must have PHIDs or edge specs as values (found value \"%s\" on transaction of type \"%s\").","messagePattern":"Edge transactions must have PHIDs or edge specs as values \\(found value \"(.+?)\" on transaction of type \"(.+?)\"\\)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php","lineNumber":2685,"sourceCode":"\n    return $result;\n  }\n\n  private function checkEdgeList($list, $edge_type) {\n    if (!$list) {\n      return;\n    }\n    foreach ($list as $key => $item) {\n      if (phid_get_type($key) === PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN) {\n        throw new Exception(\n          pht(\n            'Edge transactions must have destination PHIDs as in edge '.\n            'lists (found key \"%s\" on transaction of type \"%s\").',\n            $key,\n            $edge_type));\n      }\n      if (!is_array($item) && $item !== $key) {\n        throw new Exception(\n          pht(\n            'Edge transactions must have PHIDs or edge specs as values '.\n            '(found value \"%s\" on transaction of type \"%s\").',\n            $item,\n            $edge_type));\n      }\n    }\n  }\n\n  private function normalizeEdgeTransactionValue(\n    PhabricatorApplicationTransaction $xaction,\n    $edge,\n    $dst_phid) {\n\n    if (!is_array($edge)) {\n      if ($edge != $dst_phid) {\n        throw new Exception(\n          pht(","sourceCodeStart":2667,"sourceCodeEnd":2703,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php#L2667-L2703","documentation":"Each value in an edge delta list must either be an array (an edge specification dict) or a scalar equal to its own key (the plain destination PHID repeated). checkEdgeList() throws this exception when a value is a scalar that differs from its key.","triggerScenarios":"Building an edge list like array('PHID-USER-aaa' => 'PHID-PROJ-bbb') where key and value disagree, or mapping a list of PHIDs with array_combine() over mismatched arrays producing key=>value pairs that don't match.","commonSituations":"Copy-paste where the key was updated but the value wasn't; code that zips two different PHID arrays into one dict; passing an inverted key/value mapping from a Conduit client.","solutions":["For plain edges use the PHID as both key and value: array($phid => $phid).","For edges with metadata, use an array spec as the value: array($phid => array('data' => array(...))).","When building from a list of destination PHIDs, use array_fuse($phids) to produce identical key/value pairs."],"exampleFix":"// before\n$new = array('+' => array_fuse($phids, 'sizeof'));\n\n// after\n$new = array('+' => array_fuse($phids));","handlingStrategy":"type-guard","validationCode":"// Canonical builder: PHID keys, matching scalar values\n$new = array('+' => array_fuse($destination_phids));","typeGuard":"function isLegalEdgeListEntry($key, $value) {\n  return is_array($value) || $value === $key;\n}","tryCatchPattern":null,"preventionTips":["Use array_fuse($phids) for plain edge lists so keys always equal values.","Never combine two different PHID arrays into a key=>value dict.","Review any code that hand-builds edge dicts for key/value mismatches."],"tags":["phabricator","transactions","edges","validation"],"backgroundTag":"invalid-phid-reference","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}