Claude Code regression: UserPromptSubmit hook appears to cause empty cached text blocks
Environment:
- Linux
- Claude Code 2.1.245
- IJFW enabled as the Claude plugin
- Claude sessions using the IJFW
UserPromptSubmit hook
After enabling IJFW's full hook set globally, fresh Claude sessions repeatedly failed with:
API Error: 400 messages.N.content.1.text: cache_control cannot be set for empty text blocks
The failure made normal messages and /compact fail. Inspecting the affected JSONL transcripts found multiple assistant records containing only { "type": "text", "text": "" }. Removing those empty records from a backup-restored transcript allowed recovery.
The IJFW pre-prompt.sh log also showed internal router/module failures during this period (identifier redeclaration and a bad module path). Disabling only IJFW's UserPromptSubmit hook stopped further global injection; the remaining session-start/compaction/session-end hooks and MCP server were not the target.
Could maintainers confirm:
- Whether
pre-prompt.sh can ever emit an empty hookSpecificOutput.additionalContext or otherwise lead Claude Code to serialize an empty text block;
- Whether this hook is safe on Claude Code 2.1.245; and
- The recommended fix/workaround that preserves IJFW memory without corrupting Claude sessions?
I have local backups and can provide redacted hook output if useful.
Claude Code regression: UserPromptSubmit hook appears to cause empty cached text blocks
Environment:
UserPromptSubmithookAfter enabling IJFW's full hook set globally, fresh Claude sessions repeatedly failed with:
The failure made normal messages and
/compactfail. Inspecting the affected JSONL transcripts found multiple assistant records containing only{ "type": "text", "text": "" }. Removing those empty records from a backup-restored transcript allowed recovery.The IJFW
pre-prompt.shlog also showed internal router/module failures during this period (identifier redeclaration and a bad module path). Disabling only IJFW'sUserPromptSubmithook stopped further global injection; the remaining session-start/compaction/session-end hooks and MCP server were not the target.Could maintainers confirm:
pre-prompt.shcan ever emit an emptyhookSpecificOutput.additionalContextor otherwise lead Claude Code to serialize an empty text block;I have local backups and can provide redacted hook output if useful.