diff --git a/src/parse/state/tag.js b/src/parse/state/tag.js
index 3b79ad8406..11177514b5 100644
--- a/src/parse/state/tag.js
+++ b/src/parse/state/tag.js
@@ -90,6 +90,8 @@ export default function tag ( parser ) {
// close any elements that don't have their own closing tags, e.g.
while ( parent.name !== name ) {
+ if ( parent.type !== 'Element' ) parser.error( `${name}> attempted to close an element that was not open`, start );
+
parent.end = start;
parser.stack.pop();
diff --git a/test/parser/error-unmatched-closing-tag/error.json b/test/parser/error-unmatched-closing-tag/error.json
new file mode 100644
index 0000000000..3dd72b28da
--- /dev/null
+++ b/test/parser/error-unmatched-closing-tag/error.json
@@ -0,0 +1,8 @@
+{
+ "message": " attempted to close an element that was not open",
+ "loc": {
+ "line": 1,
+ "column": 0
+ },
+ "pos": 0
+}
diff --git a/test/parser/error-unmatched-closing-tag/input.html b/test/parser/error-unmatched-closing-tag/input.html
new file mode 100644
index 0000000000..7f5eaa32ef
--- /dev/null
+++ b/test/parser/error-unmatched-closing-tag/input.html
@@ -0,0 +1 @@
+
\ No newline at end of file