Hmbown/CodeWhale · error · ValueError
max_turns must be between 1 and 10000
Error message
max_turns must be between 1 and 10000
What it means
max_turns is an optional model-step ceiling forwarded as --max-turns to the codewhale exec run; None (the default) means unlimited. _validate_config() rejects any value outside 1..10000 so a typo cannot silently become a no-op or an unrunnable rollout.
Source
Thrown at integrations/verifiers-codewhale/codewhale_harness/harness.py:103
sandbox: Literal["auto", "read-only", "workspace-write", "external-sandbox"] = (
"auto"
)
"""`auto` keeps subprocess runs workspace-bound and trusts isolated runtimes."""
class CodewhaleHarness(Harness[CodewhaleHarnessConfig]):
APPENDS_SYSTEM_PROMPT = True
SUPPORTS_MCP = True
SUPPORTS_USER_SIM = False
def _validate_config(self) -> None:
if not _VERSION.fullmatch(self.config.version):
raise ValueError("version must be a semantic release identifier")
if (
self.config.max_turns is not None
and not 1 <= self.config.max_turns <= 10_000
):
raise ValueError("max_turns must be between 1 and 10000")
invalid = [
tool
for tool in self.config.disabled_tools or []
if not _TOOL.fullmatch(tool)
]
if invalid:
raise ValueError(
"disabled_tools must use Codewhale catalog identifiers: "
+ ", ".join(repr(tool) for tool in invalid)
)
@property
def binary(self) -> str:
configured = (self.config.binary_path or "").strip()
return configured or DEFAULT_BINARY
async def setup(self, runtime: Runtime) -> None:
self._validate_config()View on GitHub (pinned to 8880682c63)
Solutions
- Pick a value in 1..10000, e.g. 200 for typical tasks
- Set max_turns=None (or omit it) for unlimited rollouts
- Clamp sourced values: max_turns = min(10_000, max(1, value))
Example fix
# before config = CodewhaleHarnessConfig(version='0.9.1', max_turns=100000) # after config = CodewhaleHarnessConfig(version='0.9.1', max_turns=10000)
Defensive patterns
Strategy: validation
Validate before calling
if max_turns is not None:
max_turns = min(10_000, max(1, int(max_turns)))
config = CodewhaleHarnessConfig(version='0.9.1', max_turns=max_turns) Type guard
def valid_max_turns(v):
return v is None or (isinstance(v, int) and not isinstance(v, bool) and 1 <= v <= 10_000) Prevention
- Remember 0 does not mean unlimited here; use None
- Keep turn budgets explicit per benchmark
- Validate config values once at load time, not per rollout
When it happens
Trigger: Setting max_turns=0, max_turns=-5, or max_turns=10001 in CodewhaleHarnessConfig.
Common situations: Raising the ceiling for long-horizon benchmarks and overshooting; configs ported from tools where 0 means unlimited; mixing token budgets into a turn count.
Related errors
- version must be a semantic release identifier
- disabled_tools must use Codewhale catalog identifiers: ${",
- ${name} is required
- ${names.join(" or ")} is required
- ${name} is required
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/d2f48287a60a6210.
Report an issue: GitHub.