When an email campaign fails to render and shows an error "None has no attribute value", it usually means the template is trying to access a property/variable that has no value. In Jinja, "None" represents a lack of value.
Cause
Jinja uses expression and statement blocks, such as {{ }} and {% %} to render template logic. This error can occur when a variable is expected to contain an object, but no object is returned, and the code later attempts to access one of its properties.
For example, this can happen when an item is fetched from a catalog using item_by_id, but the provided item_id does not return any item. If the template then tries to access item.value, rendering fails because item has no value.
item is set first and then item.value is checked, which leads to the error when no item is returnedFix
To avoid this error, add a condition that checks whether the object exists before accessing its property.
{% set item = catalogs['Books'].item_by_id('SKU20') %}
{% if item %}
{% if item['value'] > 20 %}
some text
{% endif %}
{% else %}
the variable is empty
{% endif %}This condition ensures the code only continues if item has a value. The Jinja docs also prefer box bracket notation, such as item['value'] over dot notation (item.value), to avoid known issues.
Tip
This error is commonly caused by missing catalog items, missing variable values, or logic that assumes an object is always available. Adding a simple existence check before using the object can help prevent rendering failures.