zeroclaw-labs/zeroclaw · warning · DiagItem
{label}: no api_key set (may rely on env vars or model_provi
Error message
{label}: no api_key set (may rely on env vars or model_provider defaults) What it means
For every non-ollama provider profile, check_config_semantics verifies that an `api_key` is configured. This warning means none is set on the profile — auth will fall back to environment variables or provider defaults, which may or may not exist when a call is actually made.
Source
Thrown at crates/zeroclaw-runtime/src/doctor/mod.rs:1153
let label = format!("{family}.{alias}");
if let Some(reason) = provider_validation_error(config, &label) {
items.push(DiagItem::error(
cat,
format!("model_provider \"{label}\" is invalid: {reason}"),
));
} else {
items.push(DiagItem::ok(
cat,
format!("model_provider \"{label}\" is valid"),
));
}
// API key presence
if family != "ollama" {
if entry.api_key.as_deref().is_some() {
items.push(DiagItem::ok(cat, format!("{label}: API key configured")));
} else {
items.push(DiagItem::warn(
cat,
format!("{label}: no api_key set (may rely on env vars or model_provider defaults)"),
));
}
}
// Model configured
if let Some(model) = entry.model.as_deref() {
items.push(DiagItem::ok(cat, format!("{label}: model: {model}")));
} else {
items.push(DiagItem::warn(cat, format!("{label}: no model configured")));
}
// A missing value remains unknown until this profile is selected;
// zero is explicitly invalid because it leaves recovery with no
// usable model-context budget.
match entry.context_window {
Some(0) => items.push(DiagItem::error(View on GitHub (pinned to 88bb9c8533)
Solutions
- Set `api_key` on the provider profile if the key is stable
- Or export the provider's env var (e.g. `OPENAI_API_KEY`) in every environment that runs zeroclaw
- If the endpoint genuinely needs no key, verify a call succeeds and accept the warning
Example fix
# before [providers.openai] family = "openai" model = "gpt-4o" # after [providers.openai] family = "openai" model = "gpt-4o" api_key = "sk-..." # or: export OPENAI_API_KEY=sk-... in the runtime environment
Defensive patterns
Strategy: validation
Validate before calling
for var in OPENAI_API_KEY ANTHROPIC_API_KEY GEMINI_API_KEY; do
if [ -z "${!var}" ]; then
echo "warn: $var unset and no api_key on the profile"
fi
done Prevention
- Set api_key on the profile or export the provider env var in every unit/shell that runs zeroclaw
- Re-run `zeroclaw doctor` after changing auth sources
When it happens
Trigger: A `[providers.<name>]` entry omits `api_key` (intending env-var auth); any `zeroclaw doctor` run prints `{label}: no api_key set` for that profile.
Common situations: Env-var-based deployments where the variable is missing in some shells or service units; new provider profiles created from minimal templates; local gateways where the key is optional.
Understand the failure class
Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.
Related errors
- model route "{}" uses invalid model_provider "{}": {}
- embedding route "{}" uses invalid model_provider "{}": {}
- agent "{name}" uses invalid model_provider "{provider_ref}":
- config section `{$path}` is malformed and was reset to defau
- {label}: no model configured
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/97331082baf614ec.
Report an issue: GitHub.