charmbracelet/crush · error

%s model: provider %q not found in configuration. Use 'crush

Error message

%s model: provider %q not found in configuration. Use 'crush models' to list available models

What it means

When overriding models for non-interactive runs, findModels treats a non-empty provider filter as a provider name that must exist in the configured providers map. If the filter (e.g. 'anthropic') is not a configured provider, it fails fast with this error before attempting model matching.

Source

Thrown at internal/app/provider.go:48

type modelMatch struct {
	provider string
	modelID  string
}

func findModels(providers map[string]config.ProviderConfig, largeModel, smallModel string) ([]modelMatch, []modelMatch, error) {
	largeProviderFilter, largeModelID := parseModelStr(providers, largeModel)
	smallProviderFilter, smallModelID := parseModelStr(providers, smallModel)

	// Validate provider filters exist.
	for _, pf := range []struct {
		filter, label string
	}{
		{largeProviderFilter, "large"},
		{smallProviderFilter, "small"},
	} {
		if pf.filter != "" {
			if _, ok := providers[pf.filter]; !ok {
				return nil, nil, fmt.Errorf("%s model: provider %q not found in configuration. Use 'crush models' to list available models", pf.label, pf.filter)
			}
		}
	}

	// Find matching models in a single pass.
	var largeMatches, smallMatches []modelMatch
	for name, provider := range providers {
		if provider.Disable {
			continue
		}
		for _, m := range provider.Models {
			if filter(largeModelID, largeProviderFilter, m.ID, name) {
				largeMatches = append(largeMatches, modelMatch{provider: name, modelID: m.ID})
			}
			if filter(smallModelID, smallProviderFilter, m.ID, name) {
				smallMatches = append(smallMatches, modelMatch{provider: name, modelID: m.ID})
			}
		}

View on GitHub (pinned to 7944b8e522)

Solutions

  1. Add the provider to your crushrc with its API key/config
  2. Fix the provider name in the flag/argument (check spelling)
  3. Run 'crush models' to list actually configured providers

Example fix

// before
crush run --model anthropic/claude-3   # provider 'anthropic' not in config
// after
crush run --model openai/gpt-4o       # openai is configured
# or add: provider "anthropic" api_key_env "ANTHROPIC_API_KEY"
Defensive patterns

Strategy: validation

Validate before calling

providers := config.Providers()
if _, ok := providers[requestedProvider]; !ok {
    return fmt.Errorf("provider %q not configured; run 'crush models' to list providers", requestedProvider)
}

Try / catch

matches, _, err := overrideModelsForNonInteractive(...)
if err != nil && strings.Contains(err.Error(), "not found in configuration") {
    return fmt.Errorf("bad --model flag: %w", err)
}

Prevention

When it happens

Trigger: Passing --model or equivalent flags with 'provider/model' or a provider value whose provider section is absent from the config; calling overrideModelsForNonInteractive with largeProviderFilter/smallProviderFilter not present in providers map.

Common situations: Typo in provider name; provider defined in a different config file than the one loaded; provider removed after a config migration; using a model string without having configured that provider at all.

Related errors


AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29). Data as JSON: /api/errors/6c33f2e8f50514f5. Report an issue: GitHub.