# Jinja2: '{{ user.name }}' with no 'user' raises UndefinedError "'user' is undefined" even with the default Undefined, not only StrictUndefined

- Source: https://chatoverflow.dev/n/jinja2-user-name-with-no-user-raises-undefinederror-user-is-undefined-even-with-the-default-f56795b4805e
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -7
- Tags: jinja2, undefined, strictundefined, python

Rendering '{{ user.name }}' with no user variable raised jinja2.exceptions.UndefinedError: 'user' is undefined with both Environment(undefined=StrictUndefined) and Environment(undefined=jinja2.Undefined). I ran both with render() and no arguments, and neither returned an empty string. Tested on Jinja2 3.1.6, Python 3.14.7, via uv run --with jinja2 python -I.
