Hmbown/CodeWhale · error
agent profile {} provider cannot be empty
Error message
agent profile {} provider cannot be empty What it means
validate_agent_profile_provider rejects a provider value that is empty after trimming. The provider field is the only place a profile establishes its provider (callers never infer it from model), and it must resolve to a built-in provider or a [providers.<id>] entry in the session config, so a blank value is refused rather than defaulted.
Source
Thrown at crates/tui/src/fleet/profile.rs:500
bail!(
"agent profile {} model must be a visible model id without whitespace or secrets",
path.display()
);
}
Ok(())
}
/// Validate an explicit `provider` field as a safe provider id (#4093).
///
/// Built-in providers are accepted by the runtime vocabulary, and user-named
/// OpenAI-compatible custom providers are accepted as simple tokens so the
/// launch path can resolve `[providers.<id>]` from the session config (#3965).
/// This field remains the ONLY place a profile's provider is established:
/// callers never infer it from `model` (EPIC #2608).
fn validate_agent_profile_provider(path: &Path, value: &str) -> Result<()> {
let trimmed = value.trim();
if trimmed.is_empty() {
bail!("agent profile {} provider cannot be empty", path.display());
}
if trimmed != value || !trimmed.chars().all(is_agent_profile_token_char) {
bail!(
"agent profile {} provider must be a simple provider id",
path.display()
);
}
Ok(())
}
fn normalize_agent_profile_reasoning_effort(
path: &Path,
value: Option<&str>,
) -> Result<Option<String>> {
let Some(value) = non_empty_trimmed(value) else {
return Ok(None);
};
if matches!(View on GitHub (pinned to 0c42157ee5)
Solutions
- Remove the provider key entirely when no explicit provider is intended - the launch path then resolves it from session config
- Or set a real provider id: provider = "anthropic" or your custom [providers.<id>] key
- If generating profiles programmatically, skip the field when the value would be blank instead of writing an empty string
Example fix
# before provider = "" # after provider = "anthropic" # or omit the key entirely
Defensive patterns
Strategy: validation
Validate before calling
fn provider_or_none(value: Option<&str>) -> Option<&str> {
value.map(str::trim).filter(|v| !v.is_empty())
}
// serialize Option::None (skip the key) instead of Some(""), and validate before load Type guard
fn is_valid_provider(value: &str) -> bool {
let t = value.trim();
!t.is_empty()
&& t.chars().all(|c| c.is_ascii_alphanumeric() || matches!(c, '-' | '_' | '.'))
} Try / catch
match load_agent_profile_file(&path) {
Ok(p) => Ok(p),
Err(err) if err.to_string().contains("provider cannot be empty") => {
Err(anyhow!("profile {path:?}: drop the provider key or set a real provider id"))
}
Err(err) => Err(err),
} Prevention
- Omit the provider key when unset instead of writing an empty string
- Run drafted/programmatic profiles through the same trim-then-validate pipeline as file loads
- Default provider resolution to session config rather than blank profile values
When it happens
Trigger: A provider field that reaches validation as "" or whitespace-only. The file loader drops blank provider values before validating, so in practice this surfaces from the drafted/programmatic profile paths that run the validator directly on constructed values.
Common situations: A model-drafted or scripted profile emitting provider = "" because the user left the provider unset; serialization code that writes an empty provider key instead of omitting it.
Related errors
- agent profile {} {field} cannot be empty
- agent profile {} {field} must be a simple token
- agent profile {} provider must be a simple provider id
- context_window must be greater than 0
- custom provider '{provider_id}' must set [providers.{provide
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/a5649bd8b2d6aaaf.
Report an issue: GitHub.