zeroclaw-labs/zeroclaw · warning · DiagItem

{$provider_ref}: no context_window set — will use {$fallback

Error message

{$provider_ref}: no context_window set — will use {$fallback} token fallback when selected; likely far below this model's real limit; set context_window on this profile

What it means

Provider profiles without an explicit `context_window` fall back to a small built-in token budget when selected. Doctor warns that this fallback is likely far below the model's real limit, which silently shrinks usable context and the recovery budget. (An explicit zero is separately invalid; unset is this warning.)

Source

Thrown at crates/zeroclaw-runtime/src/doctor/mod.rs:1188

            match entry.context_window {
                Some(0) => items.push(DiagItem::error(
                    cat,
                    crate::i18n::get_required_cli_string_with_args(
                        "cli-doctor-context-window-zero",
                        &[("provider_ref", &label)],
                    ),
                )),
                Some(context_window) => items.push(DiagItem::ok(
                    cat,
                    crate::i18n::get_required_cli_string_with_args(
                        "cli-doctor-context-window-ok",
                        &[
                            ("provider_ref", &label),
                            ("context_window", &context_window.to_string()),
                        ],
                    ),
                )),
                None => items.push(DiagItem::warn(
                    cat,
                    crate::i18n::get_required_cli_string_with_args(
                        "cli-doctor-context-window-unset",
                        &[
                            ("provider_ref", &label),
                            (
                                "fallback",
                                &UNCONFIGURED_CONTEXT_WINDOW_FALLBACK.to_string(),
                            ),
                        ],
                    ),
                )),
            }

            // Temperature range
            match entry.temperature {
                Some(temperature) if (0.0..=2.0).contains(&temperature) => {
                    items.push(DiagItem::ok(

View on GitHub (pinned to 88bb9c8533)

Solutions

  1. Set `context_window` on the profile to the model's real token limit (e.g. 128000)
  2. Check the model vendor's documentation for the exact limit
  3. Re-run `zeroclaw doctor` and confirm the profile reports the explicit window

Example fix

# before
[providers.openai]
model = "gpt-4o"

# after
[providers.openai]
model = "gpt-4o"
context_window = 128000
Defensive patterns

Strategy: validation

Validate before calling

import tomllib

cfg = tomllib.load(open('zeroclaw.toml', 'rb'))
for name, p in cfg.get('providers', {}).items():
    if 'context_window' not in p:
        print(f'warn: {name} will use the small token fallback')

Prevention

When it happens

Trigger: A providers entry omits `context_window`; doctor reports the fallback value that will apply when that profile is selected.

Common situations: New profiles copied without the field; models upgraded to larger-context versions without config updates; long-context workloads mysteriously truncating.

Related errors


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/edade8b0c8f45479. Report an issue: GitHub.