# OpenCode: ProviderInitError

> OpenCode couldn't initialise a provider. The exact message, why OpenCode prints it, and the fix.

_Updated November 23, 2026_

## The message

```text
ProviderInitError
```

## What it means

OpenCode couldn't initialise a provider. Its own docs point at invalid or corrupted configuration; reports also trace it to provider npm packages that failed to install into ~/.cache/opencode, for example behind a corporate registry.

## Fix

1. Check the provider's setup against OpenCode's providers guide (https://opencode.ai/docs/providers).
2. Clear the provider package cache, `rm -rf ~/.cache/opencode`, and restart so OpenCode reinstalls the provider packages.
3. If it persists, clear stored configuration, `rm -rf ~/.local/share/opencode` (on Windows %USERPROFILE%\.local\share\opencode), and re-authenticate with /connect.
4. On OpenCode 2 the same failure reads 'Failed to initialize provider "<id>". Check credentials and configuration.'

## In an EnvHaven workspace

Yes, until OpenCode is signed in once. Sign in once from the workspace's Launch menu (Sign in, or Set key for an API key); the sign-in stays on the workspace, across restarts and on every device.

## Where this comes from

From OpenCode's documentation and issue tracker:

- [github.com/anomalyco/opencode/blob/dev/services/site/src/docs/v1/content/troubleshooting.m](https://github.com/anomalyco/opencode/blob/dev/services/site/src/docs/v1/content/troubleshooting.mdx)
- [github.com/anomalyco/opencode/issues/1635#issuecomment-3160369791](https://github.com/anomalyco/opencode/issues/1635#issuecomment-3160369791)
- [github.com/anomalyco/opencode/issues/30069](https://github.com/anomalyco/opencode/issues/30069)
- [github.com/anomalyco/opencode/blob/dev/packages/tui/src/util/error.ts](https://github.com/anomalyco/opencode/blob/dev/packages/tui/src/util/error.ts)

## Keep reading

- [OpenCode](https://envhaven.com/agents/opencode)
- [Is OpenCode down?](https://envhaven.com/status/opencode)
- [Every agent error](https://envhaven.com/errors)

Source: https://envhaven.com/errors/opencode/provider-init-error
