phacility/phabricator · error · Exception
You can not create a relationship to object "%s" because the
Error message
You can not create a relationship to object "%s" because the object does not exist or could not be loaded.
What it means
While applying relationship edits, the controller looked up each added PHID via PhabricatorObjectQuery with policy exceptions raised; an add_phid was absent from the loaded $dst_objects map, meaning the object does not exist (deleted, bad PHID) or the acting user cannot see it (policy-filtered). The exception is caught and converted into an 'unrelatable object' dialog response (newUnrelatableObjectResponse), so users normally see a friendly error instead of the raw message.
Source
Thrown at src/applications/search/controller/PhabricatorSearchRelationshipController.php:86
$capabilities = $relationship->getRequiredRelationshipCapabilities();
if ($all_phids) {
$dst_objects = id(new PhabricatorObjectQuery())
->setViewer($viewer)
->withPHIDs($all_phids)
->setRaisePolicyExceptions(true)
->requireCapabilities($capabilities)
->execute();
$dst_objects = mpull($dst_objects, null, 'getPHID');
} else {
$dst_objects = array();
}
try {
foreach ($add_phids as $add_phid) {
$dst_object = idx($dst_objects, $add_phid);
if (!$dst_object) {
throw new Exception(
pht(
'You can not create a relationship to object "%s" because '.
'the object does not exist or could not be loaded.',
$add_phid));
}
if ($add_phid == $src_phid) {
throw new Exception(
pht(
'You can not create a relationship to object "%s" because '.
'objects can not be related to themselves.',
$add_phid));
}
if (!$relationship->canRelateObjects($object, $dst_object)) {
throw new Exception(
pht(
'You can not create a relationship (of type "%s") to object '.View on GitHub (pinned to 5720a38cfe)
Solutions
- Reload the page and reopen the relationship dialog - the typeahead will no longer offer the deleted/invisible object.
- Verify the PHID still exists and is visible to the acting user (e.g. via `phid.query` Conduit call) before re-adding.
- If scripting, resolve names to PHIDs fresh at request time instead of caching PHIDs long-term.
- Check the object's view policy if you suspect permissions: the load fails silently for hidden objects and surfaces as this same error.
Example fix
// before: using a possibly stale PHID captured earlier
$request->setStr('phids', $old_phid);
// after: re-resolve right before the call
$results = id(new ConduitCall('phid.query', array('phids' => array($old_phid))))->execute();
if (empty($results[$old_phid])) { /* object gone; skip */ } Defensive patterns
Strategy: try-catch
Validate before calling
// Resolve PHIDs through the viewer before building the add list $visible = id(new PhabricatorObjectQuery()) ->setViewer($viewer) ->withPHIDs($add_phids) ->execute(); $add_phids = array_intersect($add_phids, mpull($visible, 'getPHID'));
Type guard
function phidExistsForViewer($viewer, $phid) { $o = id(new PhabricatorObjectQuery())->setViewer($viewer)->withPHIDs(array($phid))->executeOne(); return (bool)$o; } Try / catch
try {
$editor->applyTransactions($object, $xactions);
} catch (Exception $ex) {
return $this->newUnrelatableObjectResponse($ex, $done_uri); // dialog, not a 500
} Prevention
- Re-resolve PHIDs at request time; never cache them long-term in scripts
- Close and reopen stale dialogs after long editing sessions
- Verify object visibility with the acting user's session when scripting bulk edits
When it happens
Trigger: POSTing a relationship add with a PHID that was just deleted (task merged/deactivated, project archived), a malformed PHID string, or a PHID for an object the viewer has no permission to see (private project, restricted task) - typical when the dialog sat open in a stale tab while the target was removed elsewhere.
Common situations: Stale browser tabs: user opens 'Edit Subscribers', target object is deleted by someone else, submit then fails; copy-pasting PHIDs from old email/URLs where the object was later removed; policy misconfigurations where the user can reference but not load an object.
Related errors
- No such object '%s'!
- No such object '%s'!
- This request asked for "%s" on host "%s", but no site is con
- Unable to load file ("%s") for import.
- ERR-INVALID-AUTH
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/c81ea680b31990b8.
Report an issue: GitHub.