Skip to content

[aw] Semantic Function Refactoring exceeded max AI credits #51496

Description

@github-actions

Workflow Failure

Workflow: Semantic Function Refactoring
Branch: main
Run: https://github.com/github/gh-aw/actions/runs/31291416435

Warning

AI Credits Budget Exceeded

The workflow hit the configured max-ai-credits guardrail. Used 312 of 300 max (over by 12).

Increase the limit

Update max-ai-credits in your workflow frontmatter:

max-ai-credits: 600
Tips for reducing AI credit usage
  • Review the cost optimization guidance.
  • Reduce unnecessary model or tool calls in the prompt.
  • Trim large inputs or excess context that does not change the outcome.
  • Split large tasks across smaller runs when possible.

Warning

Engine Failure: The claude engine terminated unexpectedly.

Last agent output:

2026-08-09T03:05:01.251Z [DEBUG] attribution header x-anthropic-billing-header: cc_version=2.1.226.905; cc_entrypoint=sdk-cli;
2026-08-09T03:05:01.253Z [DEBUG] [API:timing] dispatching to firstParty model=claude-sonnet-4.6
2026-08-09T03:05:01.256Z [DEBUG] [API REQUEST] /v1/messages source=sdk
2026-08-09T03:05:01.508Z [ERROR] API error (attempt 1/11): 403 403 {"error":{"type":"ai_credits_limit_exceeded","message":"Maximum AI credits exceeded (311.990725 / 300).","total_ai_credits":311.990725,"max_ai_credits":300,"hard_cap":false}}
{"type":"assistant","message":{"id":"90dfbf9f-470f-4474-b072-cdc5551920d0","container":null,"model":"<synthetic>","role":"assistant","stop_details":null,"stop_reason":"stop_sequence","stop_sequence":"","type":"message","usage":{"input_tokens":0,"output_tokens":0,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"server_tool_use":{"web_search_requests":0,"web_fetch_requests":0},"service_tier":null,"cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":0},"inference_geo":null,"iterations":null,"speed":null},"content":[{"type":"text","text":"Failed to authenticate. API Error: 403 Maximum AI credits exceeded (311.990725 / 300)."}],"context_management":null},"parent_tool_use_id":null,"session_id":"7029b234-677b-47d4-abc4-6ba4c1d8d574","uuid":"66d3ebb6-7084-484c-91db-677d442f85d2","timestamp":"2026-08-09T03:05:01.520Z","error":"authentication_failed","is_api_error_message":true}
{"is_error":true,"duration_api_ms":302101,"num_turns":79,"stop_reason":"stop_sequence","session_id":"7029b234-677b-47d4-abc4-6ba4c1d8d574","total_cost_usd":1.8719443500000004,"usage":{"input_tokens":88,"cache_creation_input_tokens":120163,"cache_read_input_tokens":3566027,"output_tokens":21454,"server_tool_use":{"web_search_requests":0,"web_fetch_requests":0},"service_tier":"standard","cache_creation":{"ephemeral_1h_input_tokens":0,"ephemeral_5m_input_tokens":120163},"inference_geo":"global","iterations":[],"speed":"standard"},"modelUsage":{"claude-sonnet-4.6":{"inputTokens":9790,"outputTokens":21477,"cacheReadInputTokens":3566027,"cacheCreationInputTokens":120163,"webSearchRequests":0,"costUSD":1.8719443500000004,"contextWindow":200000,"maxOutputTokens":32000,"canonicalModel":"claude-sonnet-4-0","provider":"firstParty"}},"permission_denials":[{"tool_name":"Bash","tool_use_id":"toolu_01Su3x3Sv2PKhTJw26uM72j3","tool_input":{"command":"cat /tmp/gh-aw/agent/semantic-function-refactor/targets.txt; echo \"---\"; cat /tmp/gh-aw/agent/semantic-function-refactor/go-files.txt","description":"Read precomputed target lists"}},{"tool_name":"Bash","tool_use_id":"toolu_01HnGsySpgnea2npqvxWt648","tool_input":{"command":"grep -rn --include='*.go' '^func ' pkg/typeutil pkg/workflow | grep -v '_test.go' > /tmp/gh-aw/agent/funcs.txt; wc -l /tmp/gh-aw/agent/funcs.txt","description":"Build function inventory file"}},{"tool_name":"Bash","tool_use_id":"toolu_0136GagZeuinvieHCyw9WiZw","tool_input":{"command":"rg -n '^func ' --glob '*.go' --glob '!*_test.go' pkg/typeutil pkg/workflow > /tmp/gh-aw/agent/funcs.txt","description":"Extract all non-test function declarations"}},{"tool_name":"Bash","tool_use_id":"toolu_019SnsDW4zVHy4KH4v5X8NUV","tool_input":{"command":"rg -N -o --glob '*.go' --glob '!*_test.go' '^func (\\([^)]*\\) )?([A-Za-z_][A-Za-z0-9_]*)\\(' -r '$2' pkg/workflow pkg/typeutil | sort | uniq -c | sort -rn | awk '$1>1' | head -80","description":"Find duplicated function names"}},{"tool_name":"Bash","tool_use_id":"toolu_01Cdy23A2ja5cX2XxVVsTR1N","tool_input":{"command":"rg -N -o --glob '!*_test.go' '^func (\\([^)]*\\) )?([A-Za-z_][A-Za-z0-9_]*)\\(' -r '$2' pkg/workflow pkg/typeutil | sort | uniq -d","description":"List duplicate function names"}},{"tool_name":"Bash","tool_use_id":"toolu_01AYo3GadatWXo87ovxtzeic","tool_input":{"command":"rg -N -o --glob '!*_test.go' '^func (\\([^)]*\\) )?([A-Za-z_][A-Za-z0-9_]*)\\(' -r '$2' pkg/workflow pkg/typeutil","description":"Extract function names only","run_in_background":true}},{"tool_name":"Bash","tool_use_id":"toolu_011PrdtTuCJp5otq87vqgKBb","tool_input":{"command":"python3 .aw_scan.py 2>&1 | head -120","description":"Run duplicate function scan"}},{"tool_name":"Bash","tool_use_id":"toolu_01NJEY3GShgGNi2VNs4CQmRB","tool_input":{"command":"python3 .aw_scan.py","description":"Run duplicate function scan"}}],"terminal_reason":"api_error","fast_mode_state":"off","fast_mode_disabled_reason":"disabled_by_env","subtype":"success","api_error_status":403,"result":"Failed to authenticate. API Error: 403 Maximum AI credits exceeded (311.990725 / 300).","type":"result","duration_ms":332012,"uuid":"e00232c5-09b7-4876-94ad-c2ea2e6233b7"}
2026-08-09T03:05:01.518Z [ERROR] Error in API request: 403 {"error":{"type":"ai_credits_limit_exceeded","message":"Maximum AI credits exceeded (311.990725 / 300).","total_ai_credits":311.990725,"max_ai_credits":300,"hard_cap":false}}
2026-08-09T03:05:01.519Z [ERROR] API auth_error: Maximum AI credits exceeded (311.990725 / 300).
2026-08-09T03:05:01.527Z [DEBUG] LSP server manager shut down successfully
2026-08-09T03:05:01.527Z [DEBUG] Cleaned up session snapshot: /home/runner/.claude/shell-snapshots/snapshot-bash-1786244373647-k8msql.sh

Action Required

Assign this issue to an agent to debug and fix the issue.

Optimize token consumption

This failure was triggered by a guardrail limit (max-ai-credits). Use this prompt with any coding agent (GitHub Copilot, Claude, Gemini, etc.) to analyze token usage and reduce costs:

Optimize the agentic workflow token consumption using https://raw.githubusercontent.com/github/gh-aw/main/optimize.md

The workflow run is at https://github.com/github/gh-aw/actions/runs/31291416435
Debug with any coding agent

Use this prompt with any coding agent (GitHub Copilot, Claude, Gemini, etc.):

Debug the agentic workflow failure using https://raw.githubusercontent.com/github/gh-aw/main/debug.md

The failed workflow run is at https://github.com/github/gh-aw/actions/runs/31291416435
Manually invoke the agent

Debug this workflow failure using your favorite Agent CLI and the agentic-workflows prompt.

Tip

Stop reporting this workflow as a failure

To stop a workflow from creating failure issues, set report-failure-as-issue: false in its frontmatter:

safe-outputs:
  report-failure-as-issue: false

Generated from Semantic Function Refactoring · 312 AIC ·

  • expires on Aug 9, 2026, 3:06 PM UTC

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions