Skip to content

'ImmutableMutableProxy' object cannot be converted to 'PyDict' with Pydantic v2 #5103

@clemlesne

Description

@clemlesne

Describe the bug

Manipulating any Pydantic model type from a state raise a library error pydantic_core._pydantic_core.PydanticSerializationError: ... 'ImmutableMutableProxy' object cannot be converted to 'PyDict'.

To reproduce

  • Define two Pydantic v2 models, A and B, B a child if the first
  • Assign B to the app state as b: B = B()
  • Execute TypeAdapter(A).dump_json(self.b)
  • See the error

Expected behavior

Any manipulation of a Pydantic model inside the state work like it should out of the state.

Context

  • Python version: v3.13
  • Reflex version: v0.7.0
  • Pydantic version: v2.10.6
  • OS: Debian Bookworm
  • Browser (Optional): n/a

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions