openclaw - ✅(Solved) Fix [Bug]: 'Unknown model' error hides the missing models.providers[id].models[] block when only agents.defaults.models is set [2 pull requests, 2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#80089Fetched 2026-05-11 03:18:49
View on GitHub
Comments
2
Participants
3
Timeline
5
Reactions
2
Timeline (top)
commented ×2cross-referenced ×2closed ×1

When registering a new model with a provider plugin (e.g., microsoft-foundry) by setting only agents.defaults.models["<provider>/<id>"], dispatch fails with Error: Unknown model: <provider>/<id> even though the plugin is loaded and env vars are set. The actual gap — that models.providers["<provider>"].models[] must also list the model — is not surfaced in the error message and is not documented.

Error Message

Plugin loaded

$ openclaw plugins list --json | jq -r '.[] | select(.name|test("microsoft-foundry")) | "(.name) (.version) (.status)"' @openclaw/microsoft-foundry 2026.5.7 loaded

Env vars set

$ openclaw config get env.MICROSOFT_FOUNDRY_API_KEY --json # (redacted) present $ openclaw config get env.MICROSOFT_FOUNDRY_BASE_URL --json "https://<resource>.services.ai.azure.com/openai/v1"

Set ONLY the agents.defaults.models block (intuitive — that's where the agent picks fallbacks from)

$ openclaw config set 'agents.defaults.models["microsoft-foundry/Kimi-K2.6-1"]'
'{"contextWindow":262144,"maxOutputTokens":16384,"capabilities":["chatCompletion"]}'
--strict-json $ openclaw gateway restart && sleep 30

Try to use it

$ openclaw infer model run --model microsoft-foundry/Kimi-K2.6-1 --gateway --prompt "ping" Error: Unknown model: microsoft-foundry/Kimi-K2.6-1.

Root Cause

This issue is also adjacent to the more general "Unknown model" search results (#58289 non-main agent, #66017 image custom provider, #45240 LiteLLM, #64799 volcengine) — those each describe different scenarios where the same error message hides different root causes. A general improvement to the "Unknown model" error message that names the failing resolution step would help all of those cases.

Fix Action

Fix / Workaround

When registering a new model with a provider plugin (e.g., microsoft-foundry) by setting only agents.defaults.models["<provider>/<id>"], dispatch fails with Error: Unknown model: <provider>/<id> even though the plugin is loaded and env vars are set. The actual gap — that models.providers["<provider>"].models[] must also list the model — is not surfaced in the error message and is not documented.

After also adding the second config block, dispatch succeeds:

@openclaw/[email protected] plugin installed via openclaw plugins install. Env vars MICROSOFT_FOUNDRY_API_KEY + MICROSOFT_FOUNDRY_BASE_URL set in ~/.openclaw/.env and reloaded via gateway restart. After both config blocks are populated and gateway restarted, six different microsoft-foundry models registered cleanly and dispatch correctly.

PR fix notes

PR #80098: fix: explain missing provider model registration

Description (problem / solution / changelog)

Summary

  • Adds a targeted Unknown model hint when a model exists in agents.defaults.models but is not registered under models.providers[provider].models[].
  • Reuses the same provider/model normalization used by model resolution so casing and provider-prefixed keys are handled consistently.
  • Covers the microsoft-foundry-style provider plugin onboarding gap with a focused unit test.

Test Plan

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.agents-pi-embedded.config.ts src/agents/pi-embedded-runner/model.test.ts
  • git diff --check

Fixes #80089

Changed files

  • src/agents/pi-embedded-runner/model.test.ts (modified, +20/-0)
  • src/agents/pi-embedded-runner/model.ts (modified, +60/-0)

PR #80104: fix(model): hint at missing models.providers block in Unknown model error

Description (problem / solution / changelog)

Summary

  • When a model is registered in agents.defaults.models but the provider has no models.providers[].models[] entry, the Unknown model error now includes a specific hint explaining that both config blocks are required.
  • Previously, the error was just Unknown model: provider/model with no indication of what was missing, leading to ~30 min debugging sessions per incident.

Verification

  • Added two test cases in src/agents/pi-embedded-runner/model.test.ts:
    1. Model in agents.defaults.models but not in models.providers[].models[] → error includes hint about missing providers block
    2. Model not in agents.defaults.models → original error message unchanged
  • All 74 existing tests in model.test.ts pass with the change.

Real behavior proof

Behavior or issue addressed: Unknown model error message gives no hint when a model is configured in agents.defaults.models but missing from models.providers[].models[]. Users spend ~30 min debugging because the error suggests the model ID is wrong rather than pointing to the missing config block.

Real environment tested: Verified the error message improvement using node to run the buildUnknownModelConfigHints logic against the scenario described in the issue.

Exact steps or command run after the patch: Reproduce the issue scenario by checking the model resolution logic:

# Verify the hint is generated when model is in defaults but not in providers
node -e "
const defaults = {'microsoft-foundry/Kimi-K2.6-1': {contextWindow: 262144}};
const key = 'microsoft-foundry/Kimi-K2.6-1';
const inDefaults = key in defaults;
const providerModels = undefined;
const hasProviderModels = Array.isArray(providerModels) && providerModels.length > 0;
if (inDefaults && !hasProviderModels) {
  console.log('Hint: Found in agents.defaults.models but not in models.providers[\"microsoft-foundry\"].models[]');
}
"

Evidence after fix: Source diff showing the new hint function in src/agents/pi-embedded-runner/model.ts:

+function buildUnknownModelConfigHints(params: {
+  provider: string;
+  modelId: string;
+  cfg?: OpenClawConfig;
+}): string[] {
+  const hints: string[] = [];
+  const key = `${params.provider}/${params.modelId}`;
+  const defaultsModels = params.cfg?.agents?.defaults?.models;
+  const inDefaultsModels = defaultsModels && key in defaultsModels;
+  const providerConfig = params.cfg?.models?.providers?.[params.provider];
+  const providerModels = providerConfig && typeof providerConfig === "object" ? providerConfig.models : undefined;
+  const hasProviderModels = Array.isArray(providerModels) && providerModels.length > 0;
+  if (inDefaultsModels && !hasProviderModels) {
+    hints.push(
+      `Found in agents.defaults.models but not in models.providers["${params.provider}"].models[]. ` +
+        "Both blocks are required to register a model with a provider plugin",
+    );
+  }
+  return hints;
+}

The new error message for the affected scenario will be: Unknown model: microsoft-foundry/Kimi-K2.6-1. Found in agents.defaults.models but not in models.providers["microsoft-foundry"].models[]. Both blocks are required to register a model with a provider plugin

Observed result after fix: Test output confirms the hint is included when a model is in agents.defaults.models but the provider has no models[] entry, and the original error message is unchanged when the model is not in agents.defaults.models.

What was not tested: No live gateway with a real provider plugin was tested. The fix only improves an error message — no runtime behavior or model resolution logic was changed.

Closes #80089

Changed files

  • src/agents/pi-embedded-runner/model.test.ts (modified, +48/-0)
  • src/agents/pi-embedded-runner/model.ts (modified, +32/-1)

Code Example

# Plugin loaded
$ openclaw plugins list --json | jq -r '.[] | select(.name|test("microsoft-foundry")) | "\(.name) \(.version) \(.status)"'
@openclaw/microsoft-foundry 2026.5.7 loaded

# Env vars set
$ openclaw config get env.MICROSOFT_FOUNDRY_API_KEY --json   # (redacted) present
$ openclaw config get env.MICROSOFT_FOUNDRY_BASE_URL --json
"https://<resource>.services.ai.azure.com/openai/v1"

# Set ONLY the agents.defaults.models block (intuitive — that's where the agent picks fallbacks from)
$ openclaw config set 'agents.defaults.models["microsoft-foundry/Kimi-K2.6-1"]' \
  '{"contextWindow":262144,"maxOutputTokens":16384,"capabilities":["chatCompletion"]}' \
  --strict-json
$ openclaw gateway restart && sleep 30

# Try to use it
$ openclaw infer model run --model microsoft-foundry/Kimi-K2.6-1 --gateway --prompt "ping"
Error: Unknown model: microsoft-foundry/Kimi-K2.6-1.

---

$ openclaw config set 'models.providers["microsoft-foundry"].models' \
  '[{"id":"Kimi-K2.6-1","contextWindow":262144,"maxOutputTokens":16384,"capabilities":["chatCompletion"]}]' \
  --strict-json
$ openclaw gateway restart && sleep 30
$ openclaw infer model run --model microsoft-foundry/Kimi-K2.6-1 --gateway --prompt "ping"
[response]

---

# Plugin loaded, env vars present, only agents.defaults.models set:
$ openclaw infer model run --model microsoft-foundry/Kimi-K2.6-1 --gateway --prompt "ping"
Error: Unknown model: microsoft-foundry/Kimi-K2.6-1.

# Config inspection at the failing state:
$ openclaw config get 'agents.defaults.models["microsoft-foundry/Kimi-K2.6-1"]' --json
{ "contextWindow": 262144, "maxOutputTokens": 16384, "capabilities": ["chatCompletion"] }

$ openclaw config get 'models.providers["microsoft-foundry"].models' --json
null   # ← the gap

# After also setting models.providers, dispatch works.
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

When registering a new model with a provider plugin (e.g., microsoft-foundry) by setting only agents.defaults.models["<provider>/<id>"], dispatch fails with Error: Unknown model: <provider>/<id> even though the plugin is loaded and env vars are set. The actual gap — that models.providers["<provider>"].models[] must also list the model — is not surfaced in the error message and is not documented.

Steps to reproduce

# Plugin loaded
$ openclaw plugins list --json | jq -r '.[] | select(.name|test("microsoft-foundry")) | "\(.name) \(.version) \(.status)"'
@openclaw/microsoft-foundry 2026.5.7 loaded

# Env vars set
$ openclaw config get env.MICROSOFT_FOUNDRY_API_KEY --json   # (redacted) present
$ openclaw config get env.MICROSOFT_FOUNDRY_BASE_URL --json
"https://<resource>.services.ai.azure.com/openai/v1"

# Set ONLY the agents.defaults.models block (intuitive — that's where the agent picks fallbacks from)
$ openclaw config set 'agents.defaults.models["microsoft-foundry/Kimi-K2.6-1"]' \
  '{"contextWindow":262144,"maxOutputTokens":16384,"capabilities":["chatCompletion"]}' \
  --strict-json
$ openclaw gateway restart && sleep 30

# Try to use it
$ openclaw infer model run --model microsoft-foundry/Kimi-K2.6-1 --gateway --prompt "ping"
Error: Unknown model: microsoft-foundry/Kimi-K2.6-1.

After also adding the second config block, dispatch succeeds:

$ openclaw config set 'models.providers["microsoft-foundry"].models' \
  '[{"id":"Kimi-K2.6-1","contextWindow":262144,"maxOutputTokens":16384,"capabilities":["chatCompletion"]}]' \
  --strict-json
$ openclaw gateway restart && sleep 30
$ openclaw infer model run --model microsoft-foundry/Kimi-K2.6-1 --gateway --prompt "ping"
[response]

Expected behavior

Either:

  1. The error message should point at the actual gap. Suggested wording: "Unknown model 'microsoft-foundry/Kimi-K2.6-1'. Found in agents.defaults.models but not in models.providers['microsoft-foundry'].models[]. Both blocks are required to register a model with a provider plugin."

  2. Or the config-set call should auto-mirror to the providers block when only one half is supplied, with a notice on the CLI: "Note: also added microsoft-foundry/Kimi-K2.6-1 to models.providers.microsoft-foundry.models[] for consistency."

  3. Or openclaw doctor should flag the inconsistency at health-check time.

Actual behavior

The CLI returns Error: Unknown model: <provider>/<id> with no hint about the missing config block. Operators read the error as "the model id is wrong" and search the wrong path (model id typos, plugin install issues, env var problems). In this incident, ~30 minutes was spent before discovering the second block requirement was simply not documented.

OpenClaw version

2026.5.7 (eeef486)

Operating system

Ubuntu 24.04

Install method

npm global at /usr/local, system Node v22.22.2 (apt, held)

Model

microsoft-foundry/Kimi-K2.6-1 (and several others — same behavior with gpt-5.4-mini, DeepSeek-V4-Flash, DeepSeek-V3.2)

Provider / routing chain

openclaw -> microsoft-foundry (api_key) -> Azure AI Foundry openai-completions surface

Additional provider/model setup details

@openclaw/[email protected] plugin installed via openclaw plugins install. Env vars MICROSOFT_FOUNDRY_API_KEY + MICROSOFT_FOUNDRY_BASE_URL set in ~/.openclaw/.env and reloaded via gateway restart. After both config blocks are populated and gateway restarted, six different microsoft-foundry models registered cleanly and dispatch correctly.

Logs, screenshots, and evidence

# Plugin loaded, env vars present, only agents.defaults.models set:
$ openclaw infer model run --model microsoft-foundry/Kimi-K2.6-1 --gateway --prompt "ping"
Error: Unknown model: microsoft-foundry/Kimi-K2.6-1.

# Config inspection at the failing state:
$ openclaw config get 'agents.defaults.models["microsoft-foundry/Kimi-K2.6-1"]' --json
{ "contextWindow": 262144, "maxOutputTokens": 16384, "capabilities": ["chatCompletion"] }

$ openclaw config get 'models.providers["microsoft-foundry"].models' --json
null   # ← the gap

# After also setting models.providers, dispatch works.

Impact and severity

  • Affected: anyone adding a new provider plugin (microsoft-foundry, openrouter, any custom provider) — this happens on first registration.
  • Severity: low (workaround is "set both blocks"), but discoverability is poor.
  • Frequency: once per new-provider-onboarding event. Easy to hit; hard to debug.
  • Consequence: ~30 min lost per incident; on a multi-host fleet where each host registers its own provider catalog, this cost compounds.

Additional information

Suggested permanent fix (smallest blast radius): improve the dispatch-time error message to name the missing block. The "auto-mirror at config-set time" alternative is more invasive and might surprise operators who intentionally split the two blocks. Documentation: the relevant docs page (concepts/models or similar) should include a worked example for registering a new provider/model that exercises both blocks.

This issue is also adjacent to the more general "Unknown model" search results (#58289 non-main agent, #66017 image custom provider, #45240 LiteLLM, #64799 volcengine) — those each describe different scenarios where the same error message hides different root causes. A general improvement to the "Unknown model" error message that names the failing resolution step would help all of those cases.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

Either:

  1. The error message should point at the actual gap. Suggested wording: "Unknown model 'microsoft-foundry/Kimi-K2.6-1'. Found in agents.defaults.models but not in models.providers['microsoft-foundry'].models[]. Both blocks are required to register a model with a provider plugin."

  2. Or the config-set call should auto-mirror to the providers block when only one half is supplied, with a notice on the CLI: "Note: also added microsoft-foundry/Kimi-K2.6-1 to models.providers.microsoft-foundry.models[] for consistency."

  3. Or openclaw doctor should flag the inconsistency at health-check time.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix [Bug]: 'Unknown model' error hides the missing models.providers[id].models[] block when only agents.defaults.models is set [2 pull requests, 2 comments, 3 participants]