The Fix
pip install pydantic==1.10.15
Based on closed pydantic/pydantic issue #10489 · PR/commit linked
Production note: Most teams hit this during upgrades or environment changes. Roll out with a canary and smoke critical endpoints (health, OpenAPI/docs) before 100%.
@@ -2,7 +2,7 @@
from pathlib import Path
-from typing import Any, Dict, Generic, List, TypeVar
+from typing import Any, Generic, List, TypeVar
@pytest.mark.parametrize(
('field_type', 'input_data', 'expected_value', 'serialized_data'),
[
pytest.param(Base64Bytes, b'Zm9vIGJhcg==\n', b'foo bar', b'Zm9vIGJhcg==\n', id='Base64Bytes-reversible'),
pytest.param(Base64Str, 'Zm9vIGJhcg==\n', 'foo bar', 'Zm9vIGJhcg==\n', id='Base64Str-reversible'),
pytest.param(Base64Bytes, b'Zm9vIGJhcg==', b'foo bar', b'Zm9vIGJhcg==\n', id='Base64Bytes-bytes-input'),
pytest.param(Base64Bytes, 'Zm9vIGJhcg==', b'foo bar', b'Zm9vIGJhcg==\n', id='Base64Bytes-str-input'),
pytest.param(
Base64Bytes, bytearray(b'Zm9vIGJhcg=='), b'foo bar', b'Zm9vIGJhcg==\n', id='Base64Bytes-bytearray-input'
),
pytest.param(Base64Str, b'Zm9vIGJhcg==', 'foo bar', 'Zm9vIGJhcg==\n', id='Base64Str-bytes-input'),
pytest.param(Base64Str, 'Zm9vIGJhcg==', 'foo bar', 'Zm9vIGJhcg==\n', id='Base64Str-str-input'),
pytest.param(
Base64Str, bytearray(b'Zm9vIGJhcg=='), 'foo bar', 'Zm9vIGJhcg==\n', id='Base64Str-bytearray-input'
),
pytest.param(
Base64Bytes,
b'BCq+6+1/Paun/Q==',
b'\x04*\xbe\xeb\xed\x7f=\xab\xa7\xfd',
b'BCq+6+1/Paun/Q==\n',
id='Base64Bytes-bytes-alphabet-vanilla',
),
],
)
def test_base64(field_type, input_data, expected_value, serialized_data):
class Model(BaseModel):
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Option A — Upgrade to fixed release\npip install pydantic==1.10.15\nWhen NOT to use: Do not use if it changes public behavior or if the failure cannot be reproduced.\n\n
Why This Fix Works in Production
- Trigger: Returns:
- Mechanism: The upgrade process introduced a TypeError due to improper use of super() in the EncodedStr class
- Why the fix works: Makes `EncodedStr` a dataclass, addressing issues related to Python version compatibility. (first fixed release: 1.10.15).
- If left unfixed, the same config can fail only in production (env differences), causing startup failures or partial feature outages.
Why This Breaks in Prod
- Triggered by an upgrade/regression window: 3.12 breaks; 1.10.15 is the first fixed release.
- Shows up under Python 3.7 in real deployments (not just unit tests).
- The upgrade process introduced a TypeError due to improper use of super() in the EncodedStr class
- Surfaces as: Returns:
Proof / Evidence
- GitHub issue: #10489
- Fix PR: https://github.com/pydantic/pydantic/pull/9047
- First fixed release: 1.10.15
- Affected versions: 3.12
- Reproduced locally: No (not executed)
- Last verified: 2026-02-09
- Confidence: 0.75
- Did this fix it?: Yes (upstream fix exists)
- Own content ratio: 0.28
Discussion
High-signal excerpts from the issue thread (symptoms, repros, edge-cases).
“We don't use the original pyupgrade, but the ruff version of it, and it is not applied on test files. Does this block anything on…”
“<details> <summary>Here is pytest output:</summary> py from typing import Union from pydantic import TypeAdapter ta: TypeAdapter[Union[str, int]] = TypeAdapter(Union[str, int]) # type: ignore[arg-type] </details>”
“ruff is doing many types of cleanups but is not upgrading python code to exact python version syntax. Really could you please try to filter…”
“> What do you mean by that? Ruff implements all pyupgrade rules, and iirc has some extra rules compared to pyupgrade”
Failure Signature (Search String)
- Returns:
Error Message
Stack trace
Error Message
-------------
Returns:
A type adapter configured for the specified `type`.
"""
if _type_has_config(type) and config is not None:
raise PydanticUserError(
'Cannot use `config` when the type is a BaseModel, dataclass or TypedDict.'
' These types can have their own config and setting the config via the `config`'
' parameter to TypeAdapter will not override it, thus the `config` you passed to'
' TypeAdapter becomes meaningless, which is probably not what you want.',
code='type-adapter-config-unused',
)
E pydantic.errors.PydanticUserError: Cannot use `config` when the type is a BaseModel, dataclass or TypedDict. These types can have their own config and setting the config via the `config` parameter to TypeAdapter will not override it, thus the `config` you passed to TypeAdapter becomes meaningless, which is probably not what you want.
E
E For further information visit https://errors.pydantic.dev/2.9/u/type-adapter-config-unused
pydantic/type_adapter.py:231: PydanticUserError
________________________________________________________________________________________ test_field _________________________________________________________________________________________
@pytest.mark.xfail(reason='description is currently dropped')
def test_field()
... (truncated) ...
Minimal Reproduction
@pytest.mark.parametrize(
('field_type', 'input_data', 'expected_value', 'serialized_data'),
[
pytest.param(Base64Bytes, b'Zm9vIGJhcg==\n', b'foo bar', b'Zm9vIGJhcg==\n', id='Base64Bytes-reversible'),
pytest.param(Base64Str, 'Zm9vIGJhcg==\n', 'foo bar', 'Zm9vIGJhcg==\n', id='Base64Str-reversible'),
pytest.param(Base64Bytes, b'Zm9vIGJhcg==', b'foo bar', b'Zm9vIGJhcg==\n', id='Base64Bytes-bytes-input'),
pytest.param(Base64Bytes, 'Zm9vIGJhcg==', b'foo bar', b'Zm9vIGJhcg==\n', id='Base64Bytes-str-input'),
pytest.param(
Base64Bytes, bytearray(b'Zm9vIGJhcg=='), b'foo bar', b'Zm9vIGJhcg==\n', id='Base64Bytes-bytearray-input'
),
pytest.param(Base64Str, b'Zm9vIGJhcg==', 'foo bar', 'Zm9vIGJhcg==\n', id='Base64Str-bytes-input'),
pytest.param(Base64Str, 'Zm9vIGJhcg==', 'foo bar', 'Zm9vIGJhcg==\n', id='Base64Str-str-input'),
pytest.param(
Base64Str, bytearray(b'Zm9vIGJhcg=='), 'foo bar', 'Zm9vIGJhcg==\n', id='Base64Str-bytearray-input'
),
pytest.param(
Base64Bytes,
b'BCq+6+1/Paun/Q==',
b'\x04*\xbe\xeb\xed\x7f=\xab\xa7\xfd',
b'BCq+6+1/Paun/Q==\n',
id='Base64Bytes-bytes-alphabet-vanilla',
),
],
)
def test_base64(field_type, input_data, expected_value, serialized_data):
class Model(BaseModel):
Environment
- Python: 3.7
- Pydantic: 2
What Broke
Pytest fails on 14 units with TypeError, impacting testing and deployment.
Why It Broke
The upgrade process introduced a TypeError due to improper use of super() in the EncodedStr class
Fix Options (Details)
Option A — Upgrade to fixed release Safe default (recommended)
pip install pydantic==1.10.15
Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.
Fix reference: https://github.com/pydantic/pydantic/pull/9047
First fixed release: 1.10.15
Last verified: 2026-02-09. Validate in your environment.
When NOT to Use This Fix
- Do not use if it changes public behavior or if the failure cannot be reproduced.
Verify Fix
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
Did This Fix Work in Your Case?
Quick signal helps us prioritize which fixes to verify and improve.
Prevention
- Add a CI check that diffs key outputs after upgrades (OpenAPI schema snapshots, JSON payload shapes, CLI output).
- Upgrade behind a canary and run integration tests against the canary before 100% rollout.
Version Compatibility Table
| Version | Status |
|---|---|
| 3.12 | Broken |
| 1.10.15 | Fixed |
Related Issues
No related fixes found.
Sources
We don’t republish the full GitHub discussion text. Use the links above for context.