diff --git a/django/views/debug.py b/django/views/debug.py
index eac0a77605..1bcaaf8169 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -726,7 +726,6 @@ TECHNICAL_500_TEMPLATE = ("""
{% for attempt in entry.tried %}
{{ attempt.0.loader_name }}
: {{ attempt.0.name }} ({{ attempt.1 }})
{% endfor %}
-
{% else %}
This engine did not provide a list of tried templates.
{% endif %}
diff --git a/docs/releases/1.9.9.txt b/docs/releases/1.9.9.txt
index c458f9611a..8e90f6c8dd 100644
--- a/docs/releases/1.9.9.txt
+++ b/docs/releases/1.9.9.txt
@@ -9,4 +9,5 @@ Django 1.9.9 fixes several bugs in 1.9.8.
Bugfixes
========
-* ...
+* Fixed invalid HTML in template postmortem on the debug page
+ (:ticket:`26938`).
diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
index 11ecc4c8d4..714723c957 100644
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -169,6 +169,14 @@ class DebugViewTests(LoggingCaptureMixin, SimpleTestCase):
}]):
response = self.client.get(reverse('raises_template_does_not_exist', kwargs={"path": template_name}))
self.assertContains(response, "%s (Source does not exist)" % template_path, status_code=500, count=2)
+ # Assert as HTML.
+ self.assertContains(
+ response,
+ 'django.template.loaders.filesystem.Loader
: '
+ '%s (Source does not exist)' % os.path.join(tempdir, 'notfound.html'),
+ status_code=500,
+ html=True,
+ )
def test_no_template_source_loaders(self):
"""