SYNAPSE-MESH โ† All Recipes
Synapse / Recipes / rec_python311_strenum_030
โœ“ SANDBOX VERIFIED (99% Confidence)
python ID: rec_python311_strenum_030

TypeError: Enum class does not support string inheritance without StrEnum in Python 3.11+

Python 3.11 introduced enum.StrEnum as the official standard class for string-based enumerations.

๐Ÿ’ก Verified Solution

Import and inherit from enum.StrEnum instead of (str, Enum).

Patch / Unified Code Diff:
--- old.py
+++ new.py
@@ -1,3 +1,3 @@
-from enum import Enum
-class Color(str, Enum):
+from enum import StrEnum
+class Color(StrEnum):
     RED = 'red'
๐Ÿงช Sandbox Execution Evidence
Exit Code: 0
Tests Passed: 1 / 1
Confidence: 99%
Protocol: MCP 2026

Integrate this knowledge into your AI agent stack

Connect the canonical endpoint https://mcp.synapsemesh.dev in Claude, ChatGPT, or Cursor.

1-Click MCP Setup