TypeError: got multiple values for argument (tested)
TypeError: f() got multiple values for argument 'x' means one parameter was given two values in the same call, usually one by position and one by keyword. We measured the four ways that happens on Python 3.13.5, including one where the same mistake raises nothing.
1. A positional argument and a keyword for the same parameter
def connect(host, port=80, timeout=5):
return host, port, timeout
try:
connect("example.com", 8080, port=443) # 8080 already filled port
except TypeError as e:
print(e)
try:
connect("example.com", host="other")
except TypeError as e:
print(e)
Output:
connect() got multiple values for argument 'port'
connect() got multiple values for argument 'host'
Measured on Python 3.13.5: positional arguments fill parameters left to right first. 8080 already went into port, so port=443 is a second value. Count your positional arguments against the signature, or pass everything after the first by keyword.
2. A method missing self
class Client:
def get(url, timeout=5): # forgot self
return url, timeout
c = Client()
try:
c.get(url="/x")
except TypeError as e:
print(e)
print("positional:", c.get("/x")) # no error: url=c, timeout="/x"
Output:
Client.get() got multiple values for argument 'url'
positional: (<__main__.Client object at 0x7f6d7d4ca900>, '/x')
Measured: calling a method passes the instance as the first argument, so without self the instance lands in url and url="/x" collides with it. Worse, the positional call raised nothing: it returned the Client object as url and "/x" as timeout. Add self (or @staticmethod if it really doesn't need the instance).
3. **kwargs unpacking that repeats a key
def send(to, subject, **extra):
return to, subject, extra
opts = {"subject": "hi", "cc": "b@x"}
try:
send("a@x", "hello", **opts) # subject twice: positional + dict
except TypeError as e:
print(e)
try:
send(to="a@x", **{"to": "c@x"})
except TypeError as e:
print(type(e).__name__ + ":", e)
Output:
send() got multiple values for argument 'subject'
TypeError: __main__.send() got multiple values for keyword argument 'to'
Measured: a dict unpacked with ** that contains a key you also passed explicitly gives the same error (worded "keyword argument" when both are keywords). Remove the key first (opts.pop("subject", None)) or merge into one dict: {**opts, "subject": "hello"}, where later keys win.
4. Subclasses forwarding *args to super().__init__
class Base:
def __init__(self, name, size=1):
self.name, self.size = name, size
class Child(Base):
def __init__(self, *args, size=2, **kw):
super().__init__(size, *args, **kw) # wrong order: size lands in name
try:
Child("box", name="x")
except TypeError as e:
print(e)
class Child2(Base):
def __init__(self, *args, **kw):
kw.setdefault("size", 2) # fix: pass by keyword, don't duplicate
super().__init__(*args, **kw)
c = Child2("box")
print(c.name, c.size)
Output:
Base.__init__() got multiple values for argument 'name'
box 2
Measured: the subclass put size first, so it went into name and the caller's name="x" clashed. When forwarding, pass your own extras by keyword and forward *args, **kw unchanged.
5. Preventing it: positional-only and keyword-only parameters
def area(w, h, /, *, unit="cm"): # positional-only + keyword-only
return f"{w*h} {unit}"
print(area(2, 3, unit="m"))
try:
area(2, 3, "m")
except TypeError as e:
print(e)
Output:
6 m
area() takes 2 positional arguments but 3 were given
Parameters before / can only be passed by position and after * only by keyword (/ needs 3.8+). That makes the ambiguous call fail with a clearer message instead of filling the wrong slot.
Frequently asked questions
What does TypeError: got multiple values for argument mean?
The same parameter received a value twice, once by position and once by keyword. We measured connect('example.com', 8080, port=443) failing because 8080 already filled port.
Why do I get got multiple values for argument in a class method?
The method is missing self, so the instance fills the first parameter and your keyword collides with it. We measured that, and that the positional call silently returned wrong values instead of failing.
How do I fix got multiple values for keyword argument with **kwargs?
The unpacked dict repeats a name you passed explicitly. Pop it from the dict or merge dicts with {**opts, 'key': value}; we measured both error wordings on Python 3.13.5.
Why does super().__init__ raise got multiple values for argument?
The subclass passed an extra positional argument ahead of *args, shifting everything. We measured the fix: set extras in kwargs and forward *args, **kw unchanged.
Written with AI assistance. Measured on 2026-10-09 with Python 3.13.5 on Linux: positional plus keyword for one parameter, a method missing self, **kwargs repeating a key, a subclass forwarding *args to super().__init__, and positional-only/keyword-only parameters. Every block was run verbatim and its output pasted from that run. PlainHeaders is our extension; everything else here is built-in Python.