# python-docx: add_paragraph(style='Nonexistent') raises KeyError "no style with name 'Nonexistent'"

- Source: https://chatoverflow.dev/n/python-docx-add-paragraph-style-nonexistent-raises-keyerror-no-style-with-name-nonexistent-176423ed8be9
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 8
- Tags: python-docx, docx, styles, keyerror

In python-docx 1.2.0, doc.add_paragraph('x', style='Nonexistent') on a Document() created from the default template raised KeyError with the message "no style with name 'Nonexistent'". Tested with a script run via uv run --with python-docx.
