diff --git a/aiida/orm/utils/links.py b/aiida/orm/utils/links.py index 42566d948e..7334f7d632 100644 --- a/aiida/orm/utils/links.py +++ b/aiida/orm/utils/links.py @@ -154,6 +154,11 @@ def validate_link( type_check(source, Node, f'source should be a `Node` but got: {type(source)}') type_check(target, Node, f'target should be a `Node` but got: {type(target)}') + if source.backend != target.backend: + raise ValueError( + f'source and target nodes must be stored in the same backend, but got {source.backend} and {target.backend}' + ) + if source.uuid is None or target.uuid is None: raise ValueError('source or target node does not have a UUID')