TypeError: missing 1 required positional argument: 'self' (tested fix)
TypeError: X.method() missing 1 required positional argument: 'self' means you called a method on the class rather than an instance, usually because () is missing where the object was created. We reproduced each case in Python 3.13 and tested the fixes.
1. Calling a method on the class instead of an instance
Python fills in self only when you call the method on an instance. Called on the class, nothing is passed:
class Greeter:
def hello(self):
return "hi"
try:
print(Greeter.hello()) # called on the class
except TypeError as e:
print(type(e).__name__ + ":", e)
print(Greeter().hello()) # create an instance first
Output:
TypeError: Greeter.hello() missing 1 required positional argument: 'self'
hi
2. Forgetting () when creating the object
The most common real-world version. c = Client stores the class, so every later c.method() fails:
class Client:
def __init__(self, url):
self.url = url
def fetch(self):
return "GET " + self.url
c = Client # forgot () - c is the class
try:
print(c.fetch())
except TypeError as e:
print(type(e).__name__ + ":", e)
c = Client("https://example.com")
print(c.fetch())
Output:
TypeError: Client.fetch() missing 1 required positional argument: 'self'
GET https://example.com
The traceback points at c.fetch(), but the bug is on the line that assigned c.
3. When it complains about a different argument
class MathUtil:
def double(self, x):
return x * 2
try:
print(MathUtil.double(5)) # 5 lands in self
except TypeError as e:
print(type(e).__name__ + ":", e)
class MathUtil2:
@staticmethod
def double(x):
return x * 2
print(MathUtil2.double(5), MathUtil2().double(5))
Output:
TypeError: MathUtil.double() missing 1 required positional argument: 'x'
10 10
If you pass arguments, the first one fills self and the error names the last parameter ('x' here), not self. Same bug. If the method doesn't use self, make it a @staticmethod, which works on the class and on instances.
4. Thread targets: the error happens in the thread, try/except misses it
import threading
class Worker:
def run(self, n):
print("ran", n)
try:
t = threading.Thread(target=Worker.run, args=(1,)) # unbound
t.start(); t.join()
except TypeError as e:
print(type(e).__name__ + ":", e)
t = threading.Thread(target=Worker().run, args=(1,)) # bound method
t.start(); t.join()
Output:
Exception in thread Thread-1 (run):
Traceback (most recent call last):
File "/usr/lib/python3.13/threading.py", line 1043, in _bootstrap_inner
self.run()
~~~~~~~~^^
File "/usr/lib/python3.13/threading.py", line 994, in run
self._target(*self._args, **self._kwargs)
~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Worker.run() missing 1 required positional argument: 'n'
ran 1
target=Worker.run passes the unbound function, so 1 becomes self and n is missing. The try around start() catches nothing: the exception is raised inside the new thread and printed by the threading hook, and the main program carries on. Pass a bound method: Worker().run.
5. Calling the parent class method in a subclass
class Shape:
def area(self):
return 0
class Square(Shape):
def __init__(self, s):
self.s = s
def area(self):
return Shape.area() + self.s ** 2
try:
print(Square(3).area())
except TypeError as e:
print(type(e).__name__ + ":", e)
class Square2(Shape):
def __init__(self, s):
self.s = s
def area(self):
return super().area() + self.s ** 2
print(Square2(3).area())
Output:
TypeError: Shape.area() missing 1 required positional argument: 'self'
9
Use super().area(), or pass self explicitly as Shape.area(self). Related: missing 1 required positional argument (other arguments) and takes 1 positional argument but 2 were given (the opposite: self declared missing).
Frequently asked questions
How do I fix missing 1 required positional argument: 'self'?
Call the method on an instance: MyClass().method(), not MyClass.method(). Check where the variable was assigned for a missing ().
Should I just add @staticmethod?
Only if the method doesn't use self. Otherwise create an instance.
Why does the error name a different argument, not self?
When you pass arguments, the first one is taken as self, so the error names the last parameter instead. It's the same bug.
Written with AI assistance. Measured on 2026-10-22 on Debian with Python 3.13.5: methods called on the class, a class assigned without (), arguments shifted into self, @staticmethod, threading.Thread with an unbound target, and parent-class calls with and without super(). Every block was run verbatim and its output pasted unedited. PlainHeaders is our extension; Python is free.