{"record":{"id":"316c9b29d0230e29","repo":"Hmbown/CodeWhale","slug":"context-window-must-be-greater-than-0","errorCode":null,"errorMessage":"context window must be greater than 0","messagePattern":"context window must be greater than 0","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/config.rs","lineNumber":11255,"sourceCode":"    crate::config_persistence::mutate_config_document(&config_path, |doc| {\n        crate::config_persistence::set_document_value(\n            doc,\n            &[\"providers\", key_inside, \"base_url\"],\n            base_url,\n        )\n    })\n    .with_context(|| format!(\"Failed to write config to {}\", config_path.display()))?;\n    Ok(config_path)\n}\n\n/// Persist a guided-setup context-window choice without replacing the user's\n/// surrounding TOML comments or formatting.\npub(crate) fn save_provider_context_window_for_identity(\n    identity: &ProviderIdentity,\n    _route_config: &Config,\n    context_window: u32,\n) -> Result<PathBuf> {\n    anyhow::ensure!(context_window > 0, \"context window must be greater than 0\");\n    let config_path = try_default_config_path()\n        .context(\"Failed to resolve config path for provider context window.\")?;\n    ensure_parent_dir(&config_path)?;\n    let key_inside = if identity.provider == ApiProvider::Custom {\n        let key = identity.key.trim();\n        anyhow::ensure!(!key.is_empty(), \"custom provider id cannot be empty\");\n        key\n    } else {\n        provider_config_key(identity.provider).context(\"provider context window table\")?\n    };\n    crate::config_persistence::mutate_config_document(&config_path, |doc| {\n        crate::config_persistence::set_document_value(\n            doc,\n            &[\"providers\", key_inside, \"context_window\"],\n            i64::from(context_window),\n        )\n    })\n    .with_context(|| format!(\"Failed to write config to {}\", config_path.display()))?;","sourceCodeStart":11237,"sourceCodeEnd":11273,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/config.rs#L11237-L11273","documentation":"Error \"context window must be greater than 0\" thrown in Hmbown/CodeWhale.","triggerScenarios":"Thrown at crates/tui/src/config.rs:11255 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}