[Django] #36861: technical_404.html crashes on urlpatterns with include()

1 view
Skip to first unread message

Django

unread,
Jan 13, 2026, 12:17:45 PM (2 days ago) Jan 13
to django-...@googlegroups.com
#36861: technical_404.html crashes on urlpatterns with include()
-------------------------------------+-------------------------------------
Reporter: approximated- | Type: Bug
intelligence | Component: Error
Status: new | reporting
Version: 6.0 | Severity: Normal
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
= technical_404.html crashes on urlpatterns with include() =

== Summary ==

The debug 404 page (`technical_404.html`) crashes with an `AttributeError`
when `urlpatterns` contains `URLResolver` objects created via `include()`.

== Description ==

The template iterates over URL patterns and accesses `.name`:

{{{#!django
{% if forloop.last and pat.name %}[name='{{ pat.name }}']{% endif %}
}}}

This fails because `.name` only exists on `URLPattern`, not `URLResolver`.
The `{% if %}` guard does not prevent the crash because Django's template
engine evaluates `pat.name` before checking the conditional.

== Exception ==

{{{
AttributeError: 'URLResolver' object has no attribute 'name'
}}}

== Reproduce ==

1. Configure urlpatterns with `include()` without namespace:
{{{#!python
urlpatterns = [
path("app/", include("myapp.urls")),
]
}}}
2. Set `DEBUG=True`
3. Request any non-existent URL
4. Debug 404 page crashes instead of rendering

== Fix ==

PR: https://github.com/django/django/pull/20533
--
Ticket URL: <https://code.djangoproject.com/ticket/36861>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 13, 2026, 12:35:26 PM (2 days ago) Jan 13
to django-...@googlegroups.com
#36861: technical_404.html crashes on urlpatterns with include()
-------------------------------------+-------------------------------------
Reporter: approximated- | Owner: (none)
intelligence |
Type: Bug | Status: new
Component: Error reporting | Version: 6.0
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Comment (by approximated-intelligence):

i run django 6.0.1 from PyPI in a docker and it crashes
please consider a backport
--
Ticket URL: <https://code.djangoproject.com/ticket/36861#comment:1>

Django

unread,
Jan 13, 2026, 12:39:13 PM (2 days ago) Jan 13
to django-...@googlegroups.com
#36861: technical_404.html crashes on urlpatterns with include()
---------------------------------+--------------------------------------
Reporter: Christian Bahls | Owner: (none)
Type: Bug | Status: closed
Component: Error reporting | Version: 6.0
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Changes (by Jacob Walls):

* has_patch: 1 => 0
* resolution: => duplicate
* status: new => closed
* ui_ux: 1 => 0

Comment:

Duplicate of #26886, this behavior didn't change recently. Also, it
doesn't crash, it just logs this noisy traceback.
--
Ticket URL: <https://code.djangoproject.com/ticket/36861#comment:2>

Django

unread,
Jan 14, 2026, 4:58:56 AM (yesterday) Jan 14
to django-...@googlegroups.com
#36861: technical_404.html crashes on urlpatterns with include()
---------------------------------+--------------------------------------
Reporter: Christian Bahls | Owner: (none)
Type: Bug | Status: closed
Component: Error reporting | Version: 6.0
Severity: Normal | Resolution: duplicate
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------------------------
Comment (by Christian Bahls):

yes, 20 lines of backtrace per 404 so that debugging and finding actual
problems becomes very difficult
--
Ticket URL: <https://code.djangoproject.com/ticket/36861#comment:3>
Reply all
Reply to author
Forward
0 new messages