alibaba/open-code-review · error
model %q is not available for provider %q; available models:
Error message
model %q is not available for provider %q; available models: %s
What it means
When a --model override is passed, the resolver validates it against the provider's model list (preset models plus entry models), when such a list exists. Bedrock/ambient-auth providers skip this gate because their model identifiers are account/region-scoped. This error means the requested model is not in the provider's known list.
Source
Thrown at internal/llm/resolver.go:511
var availableModels []string
if isPreset {
availableModels = append(availableModels, preset.Models...)
}
availableModels = append(availableModels, entry.Models...)
// A preset's Models list doubles as an allowlist for --model. For an
// ambient-auth provider it cannot: Bedrock identifiers are scoped to an
// account and a region, and an application inference profile ARN — a
// supported value, and the one to use when spend has to be attributed — can
// never appear in a list compiled upstream. The list stays a picker for
// `ocr config model`; it does not gate an override.
gateOverrideOnModelList := !ambientAuth
// Apply model override with validation.
if modelOverride != "" {
if gateOverrideOnModelList && len(availableModels) > 0 {
if !ModelListContains(availableModels, modelOverride) {
return ResolvedEndpoint{}, false, fmt.Errorf(
"model %q is not available for provider %q; available models: %s",
modelOverride,
cfg.Provider,
strings.Join(availableModels, ", "),
)
}
}
model = modelOverride
}
if model == "" {
return ResolvedEndpoint{}, false, fmt.Errorf("provider %q has no model configured; run 'ocr config model' to select one or pass --model", cfg.Provider)
}
if protocol == ProtocolAnthropic {
var err error
ah := "authorization"
if isPreset && authHeader != "" {View on GitHub (pinned to 5cf97d0d15)
Solutions
- Run `ocr config model` to see and pick from the provider's available models
- Pass a model name exactly as listed in the error's "available models" list
- Add the model to the provider entry's models list if your endpoint genuinely serves it
- If the model is account/region-scoped (Bedrock), use a bedrock provider so the list gate does not apply
Example fix
// before ocr review --model claude-opus-4-20250514 // error: model "claude-opus-4-20250514" is not available ... // after ocr review --model claude-sonnet-4-20250514 // a model from the available list
Defensive patterns
Strategy: validation
Validate before calling
// Go: validate the --model override against the provider's list first
func modelAllowed(model string, availableModels []string) error {
if len(availableModels) == 0 {
return nil
}
for _, m := range availableModels {
if m == model {
return nil
}
}
return fmt.Errorf("model %q not in list; available: %s", model, strings.Join(availableModels, ", "))
} Type guard
func isKnownModel(model string, available []string) bool {
for _, m := range available {
if m == model {
return true
}
}
return false
} Try / catch
ep, ok, err := resolver.ResolveEndpointWithModelOverride(cfg, modelOverride)
if err != nil && strings.Contains(err.Error(), "is not available for provider") {
fmt.Fprintf(os.Stderr, "pick one of: %v\n", err)
os.Exit(2)
} Prevention
- Run `ocr config model` to list valid models before passing --model
- Copy model names exactly from the error's available-models list (no aliases)
- When a provider gains a new model, add it to the entry's models list
- Use a bedrock/ambient-auth provider when identifiers are ARNs not in any static list
When it happens
Trigger: Running `ocr review --model <name>` (or ResolveEndpointWithModelOverride) where the model name does not match any entry in the provider's Models list while the list is non-empty and the provider is not ambient-auth.
Common situations: Typos in the model name; using a model alias not present in the preset's compiled list; a newly released model added upstream after the list was frozen; picking an OpenAI model name for an Anthropic preset.
Related errors
- model is required
- invalid max_tokens %q: must be a positive integer
- unknown config key: %s Supported keys: %s Provider fields: a
- invalid URL for %s: %w
- invalid model list for %s: %w
AI-assisted analysis of alibaba/open-code-review@5cf97d0d15 (2026-09-02).
Data as JSON: /api/errors/f03782ed0a7106b7.
Report an issue: GitHub.