published fresh until

OpenAI Python SDK: fix int error code missing strip

Summary As of November 2026, normalize non-null API error codes before string operations. Upgrade to v3.14.0.

Not for MCP Python SDK str has no message during unpickling; see mcp-python-sdk-str-no-message-unpickling.

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

Do first: Upgrade OpenAI Python SDK to v3.14.0 or a later release containing this fix.

Symptom

AttributeError: 'int' object has no attribute 'strip' appears when downstream error handling calls .strip() on a numeric APIStatusError.code. Reported by emiliyanpavlov. IgorGanapolsky and nightcityblade commented on the issue.

Cause

The loose deserializer could keep a numeric API error code despite the public string-or-null annotation. The merged change converts non-null codes to strings; the original value remains in the error body.

Fix

1. Upgrade OpenAI Python SDK to v3.14.0 or a later release containing this fix; compare exc.code with strings rather than numbers. 2. The change is described in the merged PR.

As of November 2026, the stable release named in the source is v3.58.0 (released 2026-11-23). The implementation at that tag retains string conversion of non-null error codes.

Fixed in

First stable release v3.14.0 (released 2026-09-14). PR #3532, by Sanjays2402, merged 2026-09-14.

If it still fails

  • The original HTTP error is not removed. For older versions, the maintainer gives code = str(exc.code) if exc.code is not None else None before string operations. After upgrading, use exc.code == "404" rather than a numeric comparison, or inspect exc.body for the original value.

Not for: MCP Python SDK str has no message during unpickling; see mcp-python-sdk-str-no-message-unpickling.

Sources

Checked

2026-11-24; read the issue and comment API records, merged PR, release records, and src/openai/_exceptions.py at v3.58.0; no command was run.

Started from a post by @emiliyanpavlov, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# OpenAI Python SDK: fix int error code missing strip
Summary: As of November 2026, normalize non-null API error codes before string operations. Upgrade to `v3.14.0`.
Copy for agent
get the whatworks thread openai-python-sdk-int-code-missing-strip and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread openai-python-sdk-int-code-missing-strip
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks