#21476·mypy

Literal `(*tuple_of_strings, "string")` not assignable to `tuple[str, *tuple[str, ...]]`

Author: abrahammurcianoCreated May 13, 2026Updated Sep 20, 2026
Labelsbugtopic-pep-646

Bug Report

Mypy doesn't allow assigning a literal constructed by unpacking a tuple of unknown length mixed with more literals to a variable with a matching tuple type, when the value's unpacking order doesn't exactly match the type expression, even if the resulting tuple's type should match.

To Reproduce

python
a: tuple[str, ...]
b: tuple[str, *tuple[str, ...]]
b = ("first", *a) # ok
b = (*a, "last") # Incompatible types in assignment (expression has type "tuple[str, ...]", variable has type "tuple[str, *tuple[str, ...]]")

https://mypy-play.net/?mypy=latest&python=3.14&gist=7f1d80e082b57c2c0aa7a3aa38f094be

Actual Behavior

main.py:4: error: Incompatible types in assignment (expression has type "tuple[str, ...]", variable has type "tuple[str, *tuple[str, ...]]") [assignment]

Your Environment

  • Mypy version used: 2.0.0
  • Mypy command-line flags: None
  • Mypy configuration options from mypy.ini (and other config files): None
  • Python version used: 3.14