charmbracelet/crush · error
failed to load providers during reload: %w
Error message
failed to load providers during reload: %w
What it means
During reload the store resolves providers via Providers(cfg). If provider loading fails AND no providers could be resolved at all (len(providers)==0), reload fails hard with this error, because a config with zero providers is unusable. If at least one provider loaded, it only logs a warning and continues.
Source
Thrown at internal/config/store.go:1246
// Reapply model choices made in this instance. The global config file is
// shared, so it may now name a model a sibling instance selected; a
// reload triggered by an unrelated write must not swap the user's model
// mid-session. An external edit to the config still takes effect for any
// model type this instance never chose.
maps.Copy(cfg.Models, overrides.Models)
// Reconfigure providers
env := env.New()
resolver := NewShellVariableResolver(env)
// Apply top-level env vars before configuring providers so variables
// like AWS_PROFILE are visible to the AWS SDK credential chain.
cfg.applyEnv(resolver)
providers, err := Providers(cfg)
if err != nil {
if len(providers) == 0 {
return fmt.Errorf("failed to load providers during reload: %w", err)
}
slog.Warn("Reload continuing with the previously known providers", "error", err)
}
if err := cfg.configureProviders(ctx, s, env, resolver, providers); err != nil {
return fmt.Errorf("failed to configure providers during reload: %w", err)
}
// Update store state BEFORE running model/agent setup (so they see new config)
s.setConfig(cfg)
s.loadedPaths = loadedPaths
s.resolver = resolver
s.knownProviders = providers
s.overrides = overrides
s.workspacePath = workspacePath
// Mirror startup flow: setup models and agents against NEW config.
var setupErr errorView on GitHub (pinned to 7944b8e522)
Solutions
- Fix the provider definitions in the config (correct provider IDs, required fields) per the wrapped error.
- Run while online at least once so the provider catalog can be cached, then reload.
- Restore the previously working providers block from version control or backup.
- Check the wrapped error for a registry/network failure and retry with connectivity.
Example fix
// before: provider removed entirely, zero providers remain
providers: {}
// after: keep at least one valid provider
providers:
anthropic: {api_key: "sk-..."} Defensive patterns
Strategy: fallback
Validate before calling
if len(cfg.Providers) == 0 { return errors.New("no providers configured; refusing reload") } Try / catch
if err := reload(); err != nil && strings.Contains(err.Error(), "failed to load providers") {
ensureNetwork(); ensureCatalogCache(); reload()
} Prevention
- Keep at least one valid provider block in config
- Run online once to populate the provider catalog cache
- Pin known-good provider IDs; diff config against backups
When it happens
Trigger: Providers(cfg) returns err with an empty provider set: all provider definitions invalid (bad api keys structure, unknown provider IDs, model resolution failures) or the catwalk provider registry is unreachable and no cached/fallback providers exist.
Common situations: Offline first run with no cached provider catalog; a config edit removed/mangled all provider blocks; provider ID renamed in a newer catwalk dataset.
Related errors
- cannot reload: working directory not set
- failed to reload config: %w
- failed to configure providers during reload: %w
- requested channels differ from the existing workspace; chann
- empty providers list from catwalk
AI-assisted analysis of charmbracelet/crush@7944b8e522 (2026-08-29).
Data as JSON: /api/errors/7b76809dc4ecb9b0.
Report an issue: GitHub.