Skip to content

fix: Python 3.8 compatibility in hookify config_loader#24266

Open
Sanix-Darker wants to merge 1 commit intoanthropics:mainfrom
Sanix-Darker:fix/py3.8-compat
Open

fix: Python 3.8 compatibility in hookify config_loader#24266
Sanix-Darker wants to merge 1 commit intoanthropics:mainfrom
Sanix-Darker:fix/py3.8-compat

Conversation

@Sanix-Darker
Copy link

@Sanix-Darker Sanix-Darker commented Feb 8, 2026

WHAT

The extract_frontmatter function in core/config_loader.py uses tuple[Dict[str, Any], str] (lowercase tuple) as a return type annotation. This PEP 585 syntax is only supported in Python 3.9+. On systems running Python 3.8, importing the module raises TypeError: 'type' object is not subscriptable, which crashes every hook execution, those PreToolUse, PostToolUse, and Stop all fail on every tool call, spamming errors throughout the session. The fix just adds Tuple to the typing imports and replaces the lowercase tuple annotation with Tuple, restoring compatibility with Python 3.8+.


Screenshot from 2026-02-08 22-01-00

The extract_frontmatter function in core/config_loader.py uses tuple[Dict[str, Any], str] (lowercase tuple) as a return type annotation.
This PEP 585 syntax is only supported in Python 3.9+.
On systems running Python 3.8, importing the module raises TypeError: 'type' object is not subscriptable, which crashes every hook execution, those PreToolUse, PostToolUse, and Stop all fail on every tool call, spamming errors throughout the session.
The fix just adds Tuple to the typing imports and replaces the lowercase tuple annotation with Tuple, restoring compatibility with Python 3.8+.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant