{"record":{"id":"806bfb3b0e854b05","repo":"Hmbown/CodeWhale","slug":"name-model-context-windows-model-must-be-greater-than-0","errorCode":null,"errorMessage":"{name}.model_context_windows.{model} must be greater than 0","messagePattern":"(.+?)\\.model_context_windows\\.(.+?) must be greater than 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/config.rs","lineNumber":4090,"sourceCode":"        Ok(())\n    }\n}\n\nfn validate_provider_context_window(name: &str, value: Option<u32>) -> Result<()> {\n    if value == Some(0) {\n        anyhow::bail!(\"{name}.context_window must be greater than 0\");\n    }\n    Ok(())\n}\n\nfn validate_model_context_windows(\n    name: &str,\n    table: Option<&std::collections::BTreeMap<String, u32>>,\n) -> Result<()> {\n    if let Some(table) = table {\n        for (model, window) in table {\n            if *window == 0 {\n                anyhow::bail!(\"{name}.model_context_windows.{model} must be greater than 0\");\n            }\n        }\n    }\n    Ok(())\n}\n\n#[derive(Debug, Clone, Deserialize, Default)]\nstruct ConfigFile {\n    /// Boxed so the parsed document never carries the multi-kilobyte\n    /// `Config` by value through `toml::de` and `apply_profile` frames. A\n    /// `#[tokio::test]` runs those frames on libtest's default 2 MiB stack,\n    /// which the by-value copies overflowed (#6362).\n    #[serde(flatten)]\n    base: Box<Config>,\n    profiles: Option<HashMap<String, Config>>,\n}\n\n#[derive(Debug, Clone, Deserialize, Default)]","sourceCodeStart":4072,"sourceCodeEnd":4108,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/config.rs#L4072-L4108","documentation":"Per-model context window overrides in a provider's `model_context_windows` table must be greater than zero. A zero entry would produce a zero token budget for that model, so validation rejects it. Thrown by validate_model_context_windows at config.rs:4090.","triggerScenarios":"A provider's `model_context_windows` BTreeMap contains a model whose value is exactly 0, e.g. model_context_windows = { \"gpt-4o\" = 0 }. The error names the offending provider and model.","commonSituations":"Placeholder zeros left in generated config; overriding a model whose limit was unknown and someone wrote 0; scripted config generation where a fetch returned 0.","solutions":["Set the model's window to its real positive limit.","Delete the zero entry so the model falls back to the provider-level context_window or default.","Fix the generator/lookup that emitted 0 for unknown models."],"exampleFix":"// before\nmodel_context_windows = { \"claude-x\" = 0 }\n// after\nmodel_context_windows = { \"claude-x\" = 200000 }","handlingStrategy":"validation","validationCode":"for (model, w) in provider.model_context_windows.iter().flatten() {\n    if *w == 0 { return Err(format!(\"{model} context window must be > 0\")); }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Remove unknown-model entries instead of filling them with 0.","Validate generated per-model tables before writing config."],"tags":["config","provider","model","validation"],"backgroundTag":"value-out-of-range","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T16:17:23.217Z"}