aaif-goose/goose · error
{} must be at least 4096
Error message
{} must be at least 4096 What it means
GOOSE_PLANNER_CONTEXT_LIMIT, when set, must parse as usize and be at least 4096 tokens. Smaller values are rejected because the planner needs a floor of context to function; the env var name is interpolated into the message.
Source
Thrown at crates/goose-cli/src/session/mod.rs:2717
.expect("No provider configured. Run 'goose configure' first")
};
// Try planner-specific model first, fall back to default model
let model = if let Ok(model) = config.get_param::<String>("GOOSE_PLANNER_MODEL") {
model
} else {
println!("WARNING: GOOSE_PLANNER_MODEL not found. Using default model...");
config
.get_goose_model()
.expect("No model configured. Run 'goose configure' first")
};
let planner_context_limit = match env::var(GOOSE_PLANNER_CONTEXT_LIMIT)
.ok()
.map(|v| v.parse::<usize>())
{
Some(Ok(n)) if n >= 4096 => Some(n),
Some(Ok(_)) => anyhow::bail!("{} must be at least 4096", GOOSE_PLANNER_CONTEXT_LIMIT),
Some(Err(e)) => anyhow::bail!("{}: {}", GOOSE_PLANNER_CONTEXT_LIMIT, e),
None => None,
};
let model_config =
goose::model_config::model_config_from_user_config(&provider, model.as_str())?
.with_context_limit(planner_context_limit);
let extensions = goose::config::extensions::get_enabled_extensions_with_config(config);
let reasoner = create(&provider, extensions).await?;
Ok((reasoner, model_config))
}
/// Format elapsed time duration
/// Shows seconds if less than 60, otherwise shows minutes:seconds
fn format_elapsed_time(duration: std::time::Duration) -> String {
let total_secs = duration.as_secs();
if total_secs < 60 {View on GitHub (pinned to 3810898a74)
Solutions
- Set the variable to 4096 or higher (e.g. GOOSE_PLANNER_CONTEXT_LIMIT=8192)
- Unset the variable to use the model's default context limit
Example fix
# before export GOOSE_PLANNER_CONTEXT_LIMIT=1024 # after export GOOSE_PLANNER_CONTEXT_LIMIT=8192 # or: unset GOOSE_PLANNER_CONTEXT_LIMIT
Defensive patterns
Strategy: validation
Validate before calling
const MIN: usize = 4096;
if let Ok(v) = std::env::var("GOOSE_PLANNER_CONTEXT_LIMIT") {
let n: usize = v.parse().expect("GOOSE_PLANNER_CONTEXT_LIMIT must be a number");
assert!(n >= MIN, "GOOSE_PLANNER_CONTEXT_LIMIT must be >= {}", MIN);
} Prevention
- Validate the env var at script start, not after goose fails
- Unset the variable when the default limit is acceptable
- Remember 4096 is the hard floor for the planner
When it happens
Trigger: Exporting GOOSE_PLANNER_CONTEXT_LIMIT=1024 (or any value below 4096) before any command that builds the planner, such as entering plan mode.
Common situations: Tuning copied from stale docs with a too-small number; leftover experimental values in a shell profile or .env.
Related errors
- Invalid OPENAI_BASE_URL '{}': {}
- GOOSE_SERVER__SECRET_KEY must be set when using GOOSE_EXTERN
- Planner returned no user-visible content
- Provider '{}' has dynamic_models: false but no static models
- missing required key {}: {}
AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16).
Data as JSON: /api/errors/98715aab34c71f44.
Report an issue: GitHub.