claude-code - 💡(How to fix) Fix [Bug] Git commit workflow bypasses CLAUDE.md pre-commit instructions due to missing entry-point hook [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48552Fetched 2026-04-16 06:56:58
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Author
Timeline (top)
labeled ×3commented ×1

Error Message

[{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T00:54:26.079Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n at async Z (/$bunfs/root/src/entrypoints/cli.js:5573:11056)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T00:54:26.622Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n at async G (/$bunfs/root/src/entrypoints/cli.js:5573:10286)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T00:54:26.622Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n at async G (/$bunfs/root/src/entrypoints/cli.js:5573:10286)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T12:30:25.618Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n at async Z (/$bunfs/root/src/entrypoints/cli.js:5573:11056)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T12:30:25.619Z"},{"error":"MaxFileReadTokenExceededError: File content (12163 tokens) exceeds maximum allowed tokens (10000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n at C59 (/$bunfs/root/src/entrypoints/cli.js:4537:23271)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T12:50:59.370Z"},{"error":"Error: File does not exist. Note: your current working directory is /Users/jeffdutton/Workspaces/avonrisk-sdlc.\n at call (/$bunfs/root/src/entrypoints/cli.js:4546:6176)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T13:18:48.097Z"},{"error":"Error: Request was aborted.\n at WV_ (/$bunfs/root/src/entrypoints/cli.js:1957:8412)\n at next (native:1:11)\n at aN9 (/$bunfs/root/src/entrypoints/cli.js:7557:7795)\n at next (native:1:11)\n at eN9 (/$bunfs/root/src/entrypoints/cli.js:7562:10609)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T13:21:06.899Z"},{"error":"Error: Request was aborted.\n at WV_ (/$bunfs/root/src/entrypoints/cli.js:1957:8412)\n at next (native:1:11)\n at aN9 (/$bunfs/root/src/entrypoints/cli.js:7557:7795)\n at next (native:1:11)\n at eN9 (/$bunfs/root/src/entrypoints/cli.js:7562:10609)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T13:22:21.061Z"}]

Root Cause

Bug Description Issue: CLAUDE.md pre-commit instructions are bypassed because the built-in git commit workflow has no entry-point hook

Fix Action

Fix / Workaround

The user's workaround: Rewriting CLAUDE.md to say "Before you start the git commit workflow (before git status, git diff, git log, or any commit preparation)" — explicitly naming the steps to intercept before. This works but the user shouldn't need to reverse-engineer the system prompt to write effective CLAUDE.md instructions.

Code Example

[{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T00:54:26.079Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n    at async Z (/$bunfs/root/src/entrypoints/cli.js:5573:11056)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T00:54:26.622Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n    at async G (/$bunfs/root/src/entrypoints/cli.js:5573:10286)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T00:54:26.622Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n    at async G (/$bunfs/root/src/entrypoints/cli.js:5573:10286)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T12:30:25.618Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n    at async Z (/$bunfs/root/src/entrypoints/cli.js:5573:11056)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T12:30:25.619Z"},{"error":"MaxFileReadTokenExceededError: File content (12163 tokens) exceeds maximum allowed tokens (10000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n    at C59 (/$bunfs/root/src/entrypoints/cli.js:4537:23271)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T12:50:59.370Z"},{"error":"Error: File does not exist. Note: your current working directory is /Users/jeffdutton/Workspaces/avonrisk-sdlc.\n    at call (/$bunfs/root/src/entrypoints/cli.js:4546:6176)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T13:18:48.097Z"},{"error":"Error: Request was aborted.\n    at WV_ (/$bunfs/root/src/entrypoints/cli.js:1957:8412)\n    at next (native:1:11)\n    at aN9 (/$bunfs/root/src/entrypoints/cli.js:7557:7795)\n    at next (native:1:11)\n    at eN9 (/$bunfs/root/src/entrypoints/cli.js:7562:10609)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T13:21:06.899Z"},{"error":"Error: Request was aborted.\n    at WV_ (/$bunfs/root/src/entrypoints/cli.js:1957:8412)\n    at next (native:1:11)\n    at aN9 (/$bunfs/root/src/entrypoints/cli.js:7557:7795)\n    at next (native:1:11)\n    at eN9 (/$bunfs/root/src/entrypoints/cli.js:7562:10609)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T13:22:21.061Z"}]
RAW_BUFFERClick to expand / collapse

Bug Description Issue: CLAUDE.md pre-commit instructions are bypassed because the built-in git commit workflow has no entry-point hook

What happens: CLAUDE.md says "Before committing, always run [validation command]." Claude interprets this as "before the git commit command" — which is step 6 of a multi-step workflow already in progress. The built-in system prompt commit workflow (git status → git diff → git log → analyze → git add → git commit) starts executing before Claude checks for project-specific pre-commit requirements.

Why it's subtle: "Before committing" is ambiguous. It can mean "before the git commit command" or "before you start the commit process." Claude confidently follows the first interpretation and doesn't realize it's wrong. Even when explicitly told about this problem, Claude initially tried to add MORE tooling rather than recognizing it was misunderstanding the instruction. The ambiguity is invisible to the model.

The user's workaround: Rewriting CLAUDE.md to say "Before you start the git commit workflow (before git status, git diff, git log, or any commit preparation)" — explicitly naming the steps to intercept before. This works but the user shouldn't need to reverse-engineer the system prompt to write effective CLAUDE.md instructions.

Suggested fix: The built-in git commit workflow should include an explicit first step: "Check CLAUDE.md and project instructions for any pre-commit validation requirements and run them before proceeding." This gives CLAUDE.md a natural injection point at the start of the workflow rather than competing against a procedural sequence already in flight.

Environment Info

  • Platform: darwin
  • Terminal: Apple_Terminal
  • Version: 2.1.85
  • Feedback ID: bf60d8d5-e961-426a-9e4a-e6496146a823

Errors

[{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T00:54:26.079Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n    at async Z (/$bunfs/root/src/entrypoints/cli.js:5573:11056)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T00:54:26.622Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n    at async G (/$bunfs/root/src/entrypoints/cli.js:5573:10286)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T00:54:26.622Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n    at async G (/$bunfs/root/src/entrypoints/cli.js:5573:10286)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T12:30:25.618Z"},{"error":"Error: Plugin MCP server error - mcp-config-invalid: MCP server terraform invalid: Missing environment variables: TFE_TOKEN\n    at RzH (/$bunfs/root/src/entrypoints/cli.js:2611:23646)\n    at async Z (/$bunfs/root/src/entrypoints/cli.js:5573:11056)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T12:30:25.619Z"},{"error":"MaxFileReadTokenExceededError: File content (12163 tokens) exceeds maximum allowed tokens (10000). Use offset and limit parameters to read specific portions of the file, or search for specific content instead of reading the whole file.\n    at C59 (/$bunfs/root/src/entrypoints/cli.js:4537:23271)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T12:50:59.370Z"},{"error":"Error: File does not exist. Note: your current working directory is /Users/jeffdutton/Workspaces/avonrisk-sdlc.\n    at call (/$bunfs/root/src/entrypoints/cli.js:4546:6176)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T13:18:48.097Z"},{"error":"Error: Request was aborted.\n    at WV_ (/$bunfs/root/src/entrypoints/cli.js:1957:8412)\n    at next (native:1:11)\n    at aN9 (/$bunfs/root/src/entrypoints/cli.js:7557:7795)\n    at next (native:1:11)\n    at eN9 (/$bunfs/root/src/entrypoints/cli.js:7562:10609)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T13:21:06.899Z"},{"error":"Error: Request was aborted.\n    at WV_ (/$bunfs/root/src/entrypoints/cli.js:1957:8412)\n    at next (native:1:11)\n    at aN9 (/$bunfs/root/src/entrypoints/cli.js:7557:7795)\n    at next (native:1:11)\n    at eN9 (/$bunfs/root/src/entrypoints/cli.js:7562:10609)\n    at processTicksAndRejections (native:7:39)","timestamp":"2026-04-15T13:22:21.061Z"}]

extent analysis

TL;DR

Modify the built-in git commit workflow to include an explicit first step that checks CLAUDE.md for pre-commit validation requirements.

Guidance

  • Identify the ambiguity in CLAUDE.md instructions that causes Claude to misinterpret "before committing" as "before the git commit command".
  • Consider rewriting CLAUDE.md to explicitly name the steps to intercept before, as a temporary workaround.
  • To fix the issue, modify the built-in git commit workflow to include a step that checks CLAUDE.md for pre-commit requirements at the start of the workflow.
  • Verify the fix by testing the modified workflow with different CLAUDE.md instructions and checking that Claude correctly intercepts and runs pre-commit validation requirements.

Example

No code snippet is provided as the issue is related to workflow modification and instruction interpretation.

Notes

The provided errors in the issue body seem unrelated to the main problem description, which focuses on the ambiguity in CLAUDE.md instructions and the built-in git commit workflow. The errors appear to be related to plugin configuration, file reading, and request aborts, but do not directly impact the suggested fix for the described issue.

Recommendation

Apply the workaround of rewriting CLAUDE.md to explicitly name the steps to intercept before, until the built-in git commit workflow can be modified to include an explicit first step for checking pre-commit requirements. This approach allows for immediate improvement in instruction clarity while awaiting a more permanent fix to the workflow.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING