TypeError: f() takes 1 positional argument but 2 were given
A function was called with more positional arguments than it accepts — very often a method missing self.
Seen on:
Python
Meaning
Calling obj.method(x) passes obj as the first argument automatically. A method defined as def method(x) therefore receives two arguments.
Common causes
- Instance method missing self
- Wrong number of arguments after a refactor
- Callback called with extra arguments by a framework
⚡ Quick fix
- Add self as the first parameter of instance methods
- Use @staticmethod if it doesn’t need self
- Match the call to the signature
Detailed fix by platform
Python
- python
class Api: def get(self, path): ...
How to diagnose
- Signature — How many parameters are declared?
- Call — How many are passed (including self)?
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026