withheld-max-output-token-errors

withheld-max-output-token-errors is a skill for Claude Code, Codex from ychampion/cskill-agents. It costs 27 tokens per session (469 once invoked), scanned A, original, MIT.

A recovery rule for handling an API error caused by exceeding the maximum output size. The error is held back while retries finish, then reported as a clean failure for each affected tool.

In plain words
What is it for?
It helps build tool-running loops that retry safely and return standardized tool failure messages.
Why use it?
It avoids exposing a raw error too early and gives the user a focused summary after recovery has ended.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It helps build tool-running loops that retry safely and return standardized tool failure messages.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ychampion/cskill-agents/withheld-max-output-token-errors
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ychampion/cskill-agents --skill withheld-max-output-token-errors
Clone the repo
git clone --depth 1 https://github.com/ychampion/cskill-agents

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for withheld-max-output-token-errors

README.md
[![agentmods](https://agentmods.dev/badge/skills/ychampion/cskill-agents/withheld-max-output-token-errors/github.svg)](https://agentmods.dev/skills/ychampion/cskill-agents/withheld-max-output-token-errors)
Your own site
<a href="https://agentmods.dev/skills/ychampion/cskill-agents/withheld-max-output-token-errors"><img src="https://agentmods.dev/badge/skills/ychampion/cskill-agents/withheld-max-output-token-errors/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for withheld-max-output-token-errors

Your own site · 80×15
<a href="https://agentmods.dev/skills/ychampion/cskill-agents/withheld-max-output-token-errors"><img src="https://agentmods.dev/badge/skills/ychampion/cskill-agents/withheld-max-output-token-errors.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 27 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 469 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00027 $0.00469
Opus 5.5 $0.00011 $0.00188
Sonnet 5.5 $0.00005 $0.00094
Haiku 4.5 $0.00003 $0.00047

Measured 1mo ago against content hash 5600072a5aa8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

withheld-max-output-token-errors scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

agents/claude-code/skills/withheld-max-output-token-errors/SKILL.md · 29 lines

How it starts

The opening of the file, as written. The whole thing — 29 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SKILL: Withheld Max Output Token Errors

Domain: tool-orchestration
Trigger: Use this when a user turn hits the max-output-token limit but the system keeps retrying so the recovery loop should finish before reporting an error. Source Pattern: Distilled from reviewed tool-loop and result-shaping patterns.

Core Method

Detect the API’s max_output_tokens error inside the streaming loop, suppress it while recovery continues, and only expose it once all retries settle. During that delay, emit placeholder tool_result messages that say each tool is missing so the user sees a focused failure summary instead of a raw API error. This keeps recovery logic intact while still surfacing helpful, per-tool diagnostics after the recovery path finishes.

Key Rules

  • Guard every assistant message against apiError === 'max_output_tokens' and only mark it for reporting once the recovery loop decides no more progress can happen.
  • Track tool_use IDs for the assistant messages that triggered the error and emit sanitized messages with the standard tool_result shape so downstream components can handle them like any other tool failure.
  • Log the withheld message only after isWithheldMaxOutputTokens returns true; do not surface the API error early or the SDK context may terminate the session.
  • Keep the placeholder text short, include the original error message, and mark is_error: true so tooling knows it’s still an error.
  • Preserve the tool ID so any transcripts or sidecars referencing the tool use still match the replayed replacement.

Example Application

When the per-turn token budget is exceeded while streaming a multi-tool answer, let the recovery loop run; once it fails, emit one user-facing tool_result block per tool use with the stored error message instead of leaking the API’s max_output_tokens field.

Anti-Patterns (What NOT to do)

  • Do not throw or propagate the API error immediately; SDK callers might abort and the recovery path would never execute.
  • Do not drop the tool_use IDs when rewriting the error, or transcripts/resumes will lose their references.

Read the full file on GitHub · 29 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 29 lines · 27 tokens per session scan A 5600072a5aa8

Subscribe to this mod's changes

withheld-max-output-token-errors is a skill published in the GitHub repository ychampion/cskill-agents (36 stars, last pushed 6mo ago), licensed MIT. It adds 27 tokens to every session and 469 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

report

Investigate a failure to its root cause with grounded evidence, hand the diagnosis to fix, and create a GitHub issue only when asked.

automagik-dev/genie · 30 tokens

merge

Resolve an in-progress merge or rebase by the intent of both sides, re-run the full gate on the merged tree, and finish the operation.

automagik-dev/genie · 32 tokens

tilth

Use the tilth CLI for code reading, outlining, search, callers, blast-radius deps, and structural diffs. Activate when the user asks to explore a repo, find a symbol, trace callers, read a file, view a diff, or analyze impact. Prefer tilth over grep/cat/find/ls — one invocation returns AST-aware outlines, definitions…

jahala/tilth · 95 tokens

fix

Resolve blocking review gaps through bounded repairs and independent re-review; diagnose stalled attempts without expanding scope.

automagik-dev/genie · 21 tokens

use-ivygrep

Gather focused local repository context with ivygrep before implementing, debugging, reviewing, or explaining code. Use for coding tasks involving unfamiliar paths, branch changes, stack traces, architectural relationships, callers, dependents, tests, configuration, or documentation. Prefer one bounded context pack…

bvolpato/ivygrep · 65 tokens

sephera-change-safety

Use Sephera to keep a code change safe: check a file's blast radius before editing it, re-check every file the change touches, review the change before committing, fix breaks by following their suggestion, and gate the merge on breaking symbols that still have consumers. Trigger this skill when editing, reviewing, or…

Reim-developer/Sephera · 80 tokens