{"record":{"id":"91f5f91236f8faee","repo":"phacility/phabricator","slug":"transaction-edge-specification-contains-unexpected","errorCode":null,"errorMessage":"Transaction edge specification contains unexpected key \"%s\".","messagePattern":"Transaction edge specification contains unexpected key \"(.+?)\"\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php","lineNumber":2721,"sourceCode":"          pht(\n            'Transaction edge data must either be the edge PHID or an edge '.\n            'specification dictionary.'));\n      }\n      $edge = array();\n    } else {\n      foreach ($edge as $key => $value) {\n        switch ($key) {\n          case 'src':\n          case 'dst':\n          case 'type':\n          case 'data':\n          case 'dateCreated':\n          case 'dateModified':\n          case 'seq':\n          case 'dataID':\n            break;\n          default:\n            throw new Exception(\n              pht(\n                'Transaction edge specification contains unexpected key \"%s\".',\n                $key));\n        }\n      }\n    }\n\n    $edge['dst'] = $dst_phid;\n\n    $edge_type = $xaction->getMetadataValue('edge:type');\n    if (empty($edge['type'])) {\n      $edge['type'] = $edge_type;\n    } else {\n      if ($edge['type'] != $edge_type) {\n        $this_type = $edge['type'];\n        throw new Exception(\n          pht(\n            \"Edge transaction includes edge of type '%s', but \".","sourceCodeStart":2703,"sourceCodeEnd":2739,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php#L2703-L2739","documentation":"An edge specification dictionary may only contain the internal edge columns: src, dst, type, data, dateCreated, dateModified, seq and dataID. normalizeEdgeTransactionValue() rejects any other key with this exception.","triggerScenarios":"Supplying an edge spec like array('dst' => $phid, 'priority' => 3) where 'priority' is not one of the whitelisted keys; typically from custom code trying to attach arbitrary metadata to an edge via the transaction value instead of the nested 'data' key.","commonSituations":"Developers assume edge specs accept free-form fields; porting code from a direct EdgeEditor API that tolerated extra keys; generated specs copying a full edge row plus extra computed fields.","solutions":["Move custom payload inside the 'data' key: array('dst' => $phid, 'data' => array('priority' => 3)).","Otherwise restrict the spec to the whitelisted keys and drop the extra field.","If the field must live on the edge itself, extend the edge schema rather than the transaction spec."],"exampleFix":"// before\n$edge = array('dst' => $phid, 'priority' => 3);\n\n// after\n$edge = array('dst' => $phid, 'data' => array('priority' => 3));","handlingStrategy":"validation","validationCode":"$legal = array(\n  'src' => true, 'dst' => true, 'type' => true, 'data' => true,\n  'dateCreated' => true, 'dateModified' => true, 'seq' => true,\n  'dataID' => true,\n);\nforeach ($edge as $key => $value) {\n  if (empty($legal[$key])) {\n    // move unknown keys under 'data' or reject them\n    unset($edge[$key]);\n    $edge['data'][$key] = $value;\n  }\n}","typeGuard":"function isLegalEdgeSpec(array $edge) {\n  $legal = array('src', 'dst', 'type', 'data',\n    'dateCreated', 'dateModified', 'seq', 'dataID');\n  foreach (array_keys($edge) as $key) {\n    if (!in_array($key, $legal, true)) {\n      return false;\n    }\n  }\n  return true;\n}","tryCatchPattern":null,"preventionTips":["Keep custom edge metadata inside the nested 'data' key only.","If consuming raw edge rows, filter to the whitelisted columns before reusing them as specs."],"tags":["phabricator","transactions","edges","schema-validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}