# Atlas error: Failed to initialize provider. Check credentials and configuration

> Run `atlas auth login` for the provider named in the error, re-enter the credential, then run `atlas providers` to confirm the provider is discovered.

Atlas prints Failed to initialize provider "<providerID>". Check credentials and configuration because that provider's initialization threw, so Atlas raised ProviderInitError with the providerID attached. Fix it by running `atlas auth login` for that provider and re-entering the credential, then confirming every env var the provider requires is set and that the provider block in atlas.json has a valid baseURL and a real npm package. Run `atlas providers` to confirm Atlas discovers the provider at all before you start debugging a specific model.

## Symptom

Atlas prints: Failed to initialize provider "<providerID>". Check credentials and configuration. The named provider never finishes loading, so none of its models are selectable in the session.

## Cause

Provider initialization threw an exception, so Atlas raises ProviderInitError carrying the providerID. Both the Atlas CLI formatter and the TUI error helper render exactly that sentence, which is why the wording is identical in the terminal and in the TUI.

## Fix

1. Run `atlas auth login` for the provider named in the error and re-enter the credential.
2. Check every env var that provider requires, for example AZURE_RESOURCE_NAME, CLOUDFLARE_ACCOUNT_ID, or SNOWFLAKE_ACCOUNT, and confirm they are exported in the shell that launches Atlas.
3. Validate the provider block in atlas.json: a bad baseURL or an unknown npm package will fail init.
4. Run `atlas providers` to confirm the provider is discovered at all before debugging the model.

## Why does Atlas say Failed to initialize provider

Atlas raises ProviderInitError when a provider's initialization throws, and both the CLI formatter and the TUI error helper render exactly 1 sentence: Failed to initialize provider "<providerID>". Check credentials and configuration. The named provider never finished loading, so Atlas cannot offer any of its models.

ProviderInitError is a load-time failure, not a request-time failure. Atlas tried to construct the provider client for the providerID quoted in the message, the constructor threw, and Atlas surfaced the failure with the providerID attached rather than letting a raw stack trace reach the transcript. The practical consequence is that the provider is absent from the session entirely. The three things that make initialization throw are all in your control: a missing or stale credential, a required environment variable that is not set, and a malformed provider block in atlas.json. Work through those three in order and the error clears.

## How do I fix Failed to initialize provider in Atlas

Step 1 of the documented fix is to run `atlas auth login` for the provider named in the error and re-enter the credential. A credential that is absent or stale is the most common reason initialization throws, so that single step resolves many ProviderInitError cases in Atlas.

Start with `atlas auth login`. Pick the provider whose providerID appears inside the quotes in the error message, and re-enter the credential from scratch rather than assuming the stored one is still good. Do not retype from memory. Copy the key from the provider dashboard so you know it matches. After the credential is written, restart the Atlas session so initialization runs again with the new value. If the same sentence comes back with the same providerID, the credential is not the problem and you should move on to environment variables and to the atlas.json provider block, in that order.

## Which environment variables can cause ProviderInitError

Several Atlas providers need more than an API key. Step 2 of the documented fix names 3 examples: AZURE_RESOURCE_NAME, CLOUDFLARE_ACCOUNT_ID, and SNOWFLAKE_ACCOUNT. If an env var a provider requires at init time is missing, initialization throws and Atlas reports Failed to initialize provider for that providerID.

Check every env var the provider requires, not just the obvious key. AZURE_RESOURCE_NAME, CLOUDFLARE_ACCOUNT_ID, and SNOWFLAKE_ACCOUNT are the kind of values that are needed to even construct a client, so their absence fails initialization outright rather than producing a clean auth error later. Verify the variables are exported in the same shell that launches Atlas. A value that lives only in a dotfile that the shell did not source, or one set in a different terminal tab, is invisible to the Atlas process. Print the variables in the launching shell before you start Atlas so you are testing what Atlas actually sees.

## How to check the provider block in atlas.json

Step 3 of the documented fix is to validate the provider block in atlas.json, once `atlas auth login` and the required environment variables both check out. A bad baseURL or an unknown npm package in that block will fail init, and Atlas will keep printing Failed to initialize provider for the same providerID.

The atlas.json provider block is the third source of ProviderInitError. Two mistakes dominate. First, a baseURL that is wrong: a typo, a trailing path that does not exist, or a host that is not the API host at all. Second, an npm package name that Atlas cannot resolve, which means the provider implementation is never loaded and the constructor cannot run. Read the block carefully against the providerID quoted in the error. Only that provider's block matters. Other provider blocks in atlas.json can be perfectly healthy while one broken entry produces this error on every launch.

## How to verify the Failed to initialize provider fix worked

Run `atlas providers` to verify the fix, which is step 4 of the documented sequence. The command confirms whether Atlas discovers the provider at all, and Atlas documents it as the check to run before you debug a specific model. If the provider now appears, initialization succeeded and ProviderInitError is resolved.

`atlas providers` is the correct verification step because it separates two questions that are easy to confuse. Question one is whether the provider loaded. Question two is whether a given model works. If `atlas providers` lists the provider, initialization no longer throws and ProviderInitError is behind you, so any remaining failure is a model-level or request-level issue and should be debugged as such. If `atlas providers` still does not list the provider, initialization is still throwing. Go back through the credential, the env vars, and the atlas.json provider block rather than experimenting with different models.

## What Failed to initialize provider does not mean in Atlas

Failed to initialize provider in Atlas does not mean the model is wrong, the prompt is too large, or your quota is spent. Those are 3 separate errors. ProviderInitError fires before any request is sent, so no token was ever spent and no model was ever selected for the providerID in the message.

Read the error literally. Atlas raised ProviderInitError, which means provider construction threw, which means no API call happened. Changing models will not help, because Atlas never got far enough to pick one from that provider. Shortening the prompt will not help either. Billing is not implicated. The honest caveat is that the error message is deliberately generic, since Atlas prints Check credentials and configuration rather than the underlying exception. That means you do have to check the credential, the env vars, and the atlas.json block yourself, in that order, instead of reading a precise root cause out of the message text.

## FAQ

### how to fix Failed to initialize provider in atlas

Run `atlas auth login` for the provider named in the error and re-enter the credential. Then check the provider's required env vars, validate its atlas.json block for a bad baseURL or unknown npm package, and run `atlas providers` to confirm the provider is discovered.

### what does ProviderInitError mean in atlas

ProviderInitError means provider initialization threw in Atlas. The error carries the providerID, and both the CLI formatter and the TUI error helper render the sentence Failed to initialize provider "<providerID>". Check credentials and configuration.

### atlas providers command shows nothing after I fixed my key

If `atlas providers` still does not list the provider, initialization is still throwing. Recheck the required env vars such as AZURE_RESOURCE_NAME, CLOUDFLARE_ACCOUNT_ID, or SNOWFLAKE_ACCOUNT, and validate the provider block in atlas.json.

### does a bad baseURL cause Failed to initialize provider

Yes. A bad baseURL in the provider block in atlas.json will fail init, as will an unknown npm package for the provider. Both produce Failed to initialize provider for that providerID.

### which env vars do atlas providers need besides an api key

Some Atlas providers require extra environment variables at init, for example AZURE_RESOURCE_NAME, CLOUDFLARE_ACCOUNT_ID, and SNOWFLAKE_ACCOUNT. Check every env var the provider requires and confirm it is exported in the shell that launches Atlas.

### should I switch models to get around Failed to initialize provider

No. ProviderInitError fires during provider initialization, before any model is selected or any request is sent, so switching models does not help. Fix the credential, the env vars, or the atlas.json provider block instead.

### how do I confirm Failed to initialize provider is really fixed

Run `atlas providers`. If the provider now appears in the list, Atlas discovered and initialized it, so ProviderInitError is resolved and any remaining failure is a model-level problem rather than an initialization problem.

---

Canonical HTML: https://runatlas.sh/resources/troubleshooting/provider-init-error
Source of truth: aeo_pages row `/resources/troubleshooting/provider-init-error` (segment: Troubleshooting) (this file is generated from it, never hand-edited).
Licence: Atlas is proprietary with a free core. It is not open source and there is no public source repository.
