diff --git a/src/Lib/Script/Ast/IrElement.cc b/src/Lib/Script/Ast/IrElement.cc
index 155957c2a3c3179802c082221ccf1d41a732309b..e71ba4cdeab856c3bd71d2f73575025e54e66840 100644
--- a/src/Lib/Script/Ast/IrElement.cc
+++ b/src/Lib/Script/Ast/IrElement.cc
@@ -13,6 +13,19 @@ IrElement::throwUnexpectedToken(const Token &tok) const
                              tok.toString());
 }
 
+void
+IrElement::throwUnexpectedToken(const Token &tok, const std::string &msg) const
+{
+    throw std::runtime_error("Unexpected token in location " + tok.location().toString() + ": " +
+                             tok.toString() + " with message: " + msg);
+}
+
+void
+IrElement::throwUnexpectedToken(const Token &tok, const char *msg) const
+{
+    throwUnexpectedToken(tok, std::string(msg));
+}
+
 IrElement::~IrElement() noexcept
 {
     std::erase_if(childElements, [this](IrElement *child) noexcept -> bool {
diff --git a/src/Lib/Script/Ast/IrElement.hh b/src/Lib/Script/Ast/IrElement.hh
index 4e0e13fce1b3628d6487a86bd6500aa793454d2d..53dcd66333795700f2d2a958611f9dbe20f64e95 100644
--- a/src/Lib/Script/Ast/IrElement.hh
+++ b/src/Lib/Script/Ast/IrElement.hh
@@ -116,7 +116,9 @@ protected:
     void detachElementFromParent() noexcept;
     void addChild(IrElement *) noexcept;
 
-    void throwUnexpectedToken(const Token &tok) const;
+    [[noreturn]] void throwUnexpectedToken(const Token &) const;
+    [[noreturn]] void throwUnexpectedToken(const Token &, const std::string &) const;
+    [[noreturn]] void throwUnexpectedToken(const Token &, const char *) const;
 
 public:
     virtual ~IrElement() noexcept;