{"record":{"id":"3700357b1f4476ae","repo":"warpdotdev/warp","slug":"could-not-retrieve-the-agent-mode-model-list-from","errorCode":null,"errorMessage":"Could not retrieve the agent-mode model list from the server (the request failed or returned no models). Try again later.","messagePattern":"Could not retrieve the agent-mode model list from the server \\(the request failed or returned no models\\)\\. Try again later\\.","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/common.rs","lineNumber":61,"sourceCode":"        model_id,\n        &valid_ids,\n        llm_prefs.agent_mode_models_unavailable(),\n    )\n}\n\n/// Classifies a user-supplied agent-mode model id against the available model\n/// list, distinguishing \"the model list fetch failed (so the list is empty or\n/// stale)\" from \"the id is genuinely not in a valid list\".\nfn classify_agent_mode_base_model_id(\n    model_id: &str,\n    valid_ids: &[LLMId],\n    list_unavailable: bool,\n) -> anyhow::Result<LLMId> {\n    let llm_id: LLMId = model_id.into();\n    if valid_ids.contains(&llm_id) {\n        Ok(llm_id)\n    } else if list_unavailable {\n        Err(anyhow::anyhow!(\n            \"Could not retrieve the agent-mode model list from the server \\\n             (the request failed or returned no models). Try again later.\"\n        ))\n    } else {\n        let suggestions = valid_ids\n            .iter()\n            .map(|id| id.to_string())\n            .collect::<Vec<_>>()\n            .join(\", \");\n        Err(anyhow::anyhow!(\n            \"Unknown model id '{model_id}'. Try one of: {suggestions}\"\n        ))\n    }\n}\n\npub(super) fn parse_ambient_task_id(\n    run_id: &str,\n    error_prefix: &str,","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/common.rs#L43-L79","documentation":"`classify_agent_mode_base_model_id` validates a `--model` id against the fetched agent-mode model list. When the list request failed or returned zero models (`list_unavailable`), a non-matching id is reported as a retrieval problem rather than a bad id — the point is to distinguish 'we could not check' from 'the id is wrong'. Retrying later is the intended remedy.","triggerScenarios":"Passing `--model <id>` to an agent command when the server's model-list request failed (network/auth error) or returned an empty list, so valid_ids is empty or stale and the id cannot be confirmed.","commonSituations":"Model-catalog outage or server incident; expired auth breaking the list call; offline or proxied environments; startup races where the catalog has not loaded yet.","solutions":["Retry the command after a short delay — catalog outages are usually transient","Check connectivity and auth to the server (re-login if the session expired)","Run without --model to use the default model while the catalog is unavailable","If it persists, check server status/support — the model list endpoint itself is failing"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"async fn fetch_model_ids_with_retry(tries: u32) -> Option<Vec<LLMId>> {\n    for i in 0..tries {\n        if let Ok(list) = fetch_agent_mode_models().await {\n            if !list.is_empty() { return Some(list); }\n        }\n        tokio::time::sleep(std::time::Duration::from_secs(1u64 << i)).await;\n    }\n    None\n}\n// Treat None as 'list unavailable': warn and use the default model instead of hard-failing.","typeGuard":null,"tryCatchPattern":"match classify_agent_mode_base_model_id(&id, &valid_ids, list_unavailable) {\n    Ok(llm) => llm,\n    Err(e) if list_unavailable => {\n        // Transient catalog outage: retry once, then proceed with the default model and warn\n        log::warn!(\"model list unavailable ({e}); falling back to default model\");\n        default_llm()\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Distinguish empty/failed list from a real list before validating ids","Retry catalog fetches with backoff","Show an 'unavailable' state in UIs instead of rejecting valid ids"],"tags":["model-selection","network","server","ambient-agent","retry"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}