phacility/phabricator · error · Exception
Edge transactions must have PHIDs or edge specs as values (f
Error message
Edge transactions must have PHIDs or edge specs as values (found value "%s" on transaction of type "%s").
What it means
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.
Source
Thrown at src/applications/transactions/editor/PhabricatorApplicationTransactionEditor.php:2685
return $result;
}
private function checkEdgeList($list, $edge_type) {
if (!$list) {
return;
}
foreach ($list as $key => $item) {
if (phid_get_type($key) === PhabricatorPHIDConstants::PHID_TYPE_UNKNOWN) {
throw new Exception(
pht(
'Edge transactions must have destination PHIDs as in edge '.
'lists (found key "%s" on transaction of type "%s").',
$key,
$edge_type));
}
if (!is_array($item) && $item !== $key) {
throw new Exception(
pht(
'Edge transactions must have PHIDs or edge specs as values '.
'(found value "%s" on transaction of type "%s").',
$item,
$edge_type));
}
}
}
private function normalizeEdgeTransactionValue(
PhabricatorApplicationTransaction $xaction,
$edge,
$dst_phid) {
if (!is_array($edge)) {
if ($edge != $dst_phid) {
throw new Exception(
pht(View on GitHub (pinned to 5720a38cfe)
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.
Example fix
// before
$new = array('+' => array_fuse($phids, 'sizeof'));
// after
$new = array('+' => array_fuse($phids)); Defensive patterns
Strategy: type-guard
Validate before calling
// Canonical builder: PHID keys, matching scalar values
$new = array('+' => array_fuse($destination_phids)); Type guard
function isLegalEdgeListEntry($key, $value) {
return is_array($value) || $value === $key;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid '%s' value for Edge transaction. Value should contai
- Edge transactions must have destination PHIDs as in edge lis
- Transaction edge data must either be the edge PHID or an edg
- Edge transaction includes edge of type '%s', but transaction
- Invalid '%s' value for PHID transaction. Value should contai
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/8c62febd62a61110.
Report an issue: GitHub.