TypeError: __init__() got an unexpected keyword argument 'proxies'

Python · updated 2026-11-03

Raised at the call site when a keyword argument does not match any parameter. When the call is inside a library, it usually means two packages disagree about versions: one passes an argument the other removed or renamed.

Traceback (most recent call last):
  File "/app/ai.py", line 6, in <module>
    client = OpenAI(api_key=key)
  File "/app/.venv/lib/python3.12/site-packages/openai/_client.py", line 123, in __init__
    super().__init__(
  File "/app/.venv/lib/python3.12/site-packages/openai/_base_client.py", line 856, in __init__
    self._client = http_client or SyncHttpxClientWrapper(
TypeError: Client.__init__() got an unexpected keyword argument 'proxies'

Quick fix

If the call is in your code, check the parameter name against the function's signature. If the traceback ends inside libraries, it's a version mismatch: compare the installed versions (pip show) and pin compatible ones together.

  1. Read the last frames: is the bad call in your code or between two libraries?
  2. For your code, check the signature with help(func) or the docs for the installed version.
  3. For library-to-library calls, run pip show <package> for both and look for a recent major release.
  4. Pin compatible versions in requirements or your lockfile, and reinstall.
  5. Search the library changelog for the argument name: it usually says when it was renamed or removed.
bash
# Which versions are installed?
python -m pip show openai httpx | grep -E "^(Name|Version)"

# Pin a compatible pair (example: an older SDK with a newer httpx)
python -m pip install "httpx<0.28"      # or upgrade the SDK that calls it
python -m pip freeze > requirements.lock

Why it happens

A dependency upgraded underneath another

One package (the caller) still passes an argument that a newer version of another package (the callee) removed. Fresh installs without a lockfile pull the new version and break.

Code written for a different library version

Examples, blog posts and AI-generated code often use argument names from an older or newer release than the one installed.

A typo in an argument name

timout= instead of timeout=, or a camelCase name copied from a JavaScript example.

A dataclass or model without that field

Passing a key from a dict (**data) that the class does not define, for example after an API added a new field.

Other fixes

  • Use a lockfile (uv lock, poetry.lock, pip-tools) so every environment installs the same versions.
  • When unpacking external data into a class, filter to known fields first.

Same error, other wording

  • TypeError: Client.__init__() got an unexpected keyword argument 'proxies'
  • TypeError: request() got an unexpected keyword argument 'timout'
  • TypeError: User.__init__() got an unexpected keyword argument 'created_at'

Let your coding agent catch the next one

Runheed records this error in production with the stack trace, the breadcrumbs before it and the agent session that shipped the code, and serves it to Claude Code, Cursor or any MCP client. With it connected, you can ask:

> Find the 'unexpected keyword argument' errors in production, tell me whether each is in our code or between two libraries, and fix the call or pin compatible versions with a lockfile.

Plans from $29/moSee what your agent readsSee the setupCancel any time from the billing portal

Related errors

References: Python docs: calls and keyword arguments, pip docs: pip show