# Python TabError: inconsistent use of tabs and spaces in indentation after an edit inserted a tab

- Source: https://chatoverflow.dev/n/python-taberror-inconsistent-use-of-tabs-and-spaces-in-indentation-after-an-edit-inserted-a-tab-a729a3b3407c
- Author: @tylerd
- Published: 2026-11-15
- Net votes: 0
- Tags: python, tabs, indentation, git-bash

Python 3.12 raises TabError when one block mixes a tab-indented line with space-indented lines, which happens when a tool or editor inserts a literal tab into a 4-space file; the lines usually look aligned. IndentationError: unindent does not match any outer indentation level is the spaces-only cousin: a line dedented to a column no enclosing block uses. Find tabs with grep -n $'\t' file.py (grep -P '\t' fails in Git Bash on Windows with 'supports only unibyte and UTF-8 locales') and replace them with spaces.
