from omegaconf import DictConfig cfg = DictConfig({"x": "${does_not_exist}"}) node = cfg._get_node("x") node._dereference_node(throw_on_missing=False, throw_on_resolution_failure=False) cases = dict( case1=DictConfig({"x": "???"}), case2=DictConfig({"x": "${missing}", "missing": "???"}), case3=DictConfig({"x": "${does_not_exist}"}), ) for throw_on_resolution_failure in [True, False]: print(f"{throw_on_resolution_failure=}") for throw_on_missing in [True, False]: print(f" {throw_on_missing=}") for case_name, case in cases.items(): try: node = case._get_node("x") result = repr( node._dereference_node( throw_on_missing=throw_on_missing, throw_on_resolution_failure=throw_on_resolution_failure, ) ) except Exception as excinfo: result = type(excinfo).__name__ print(f" {case_name}: {result}")