diff --git a/.github/CHANGELOG.md b/.github/CHANGELOG.md
index 17872586927..7a1d1b41017 100644
--- a/.github/CHANGELOG.md
+++ b/.github/CHANGELOG.md
@@ -367,6 +367,9 @@
being set if this is not the case.
[(#923)](https://github.com/PennyLaneAI/pennylane/pull/923)
+* Fixes broken error message if a QNode is instantiated with an unknown exception.
+ [(#930)](https://github.com/PennyLaneAI/pennylane/pull/930)
+
Contributors
This release contains contributions from (in alphabetical order):
diff --git a/pennylane/tape/qnode.py b/pennylane/tape/qnode.py
index 0155c026d0e..7697ae2109c 100644
--- a/pennylane/tape/qnode.py
+++ b/pennylane/tape/qnode.py
@@ -131,7 +131,7 @@ def __init__(self, func, device, interface="autograd", diff_method="best", **dif
if interface is not None and interface not in self.INTERFACE_MAP:
raise qml.QuantumFunctionError(
f"Unknown interface {interface}. Interface must be "
- f"one of {self.INTERFACE_MAP.values()}."
+ f"one of {list(self.INTERFACE_MAP.keys())}."
)
if not isinstance(device, Device):
diff --git a/tests/tape/tapes/test_qnode.py b/tests/tape/tapes/test_qnode.py
index 9fcf6ba69fb..74a1572ccf8 100644
--- a/tests/tape/tapes/test_qnode.py
+++ b/tests/tape/tapes/test_qnode.py
@@ -25,8 +25,13 @@ class TestValidation:
def test_invalid_interface(self):
"""Test that an exception is raised for an invalid interface"""
dev = qml.device("default.qubit", wires=1)
+ test_interface = "something"
+ expected_error = (
+ fr"Unknown interface {test_interface}\. Interface must be "
+ r"one of \['autograd', 'torch', 'tf'\]\."
+ )
- with pytest.raises(qml.QuantumFunctionError, match="Unknown interface"):
+ with pytest.raises(qml.QuantumFunctionError, match=expected_error):
QNode(None, dev, interface="something")
def test_invalid_device(self):