File size: 9,539 Bytes
0dbc9de | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | ---
title: Troubleshooting
description: Common issues and how to resolve them.
---
To debug issues with OpenCode, start by checking the logs and local data it stores on disk.
---
## Logs
Log files are written to:
- **macOS/Linux**: `~/.local/share/opencode/log/`
- **Windows**: Press `WIN+R` and paste `%USERPROFILE%\.local\share\opencode\log`
Log files are named with timestamps (e.g., `2025-01-09T123456.log`) and the most recent 10 log files are kept.
You can set the log level with the `--log-level` command-line option to get more detailed debug information. For example, `opencode --log-level DEBUG`.
---
## Storage
opencode stores session data and other application data on disk at:
- **macOS/Linux**: `~/.local/share/opencode/`
- **Windows**: Press `WIN+R` and paste `%USERPROFILE%\.local\share\opencode`
This directory contains:
- `auth.json` - Authentication data like API keys, OAuth tokens
- `log/` - Application logs
- `project/` - Project-specific data like session and message data
- If the project is within a Git repo, it is stored in `./<project-slug>/storage/`
- If it is not a Git repo, it is stored in `./global/storage/`
---
## Uninstall
To uninstall the OpenCode CLI and remove its related files, run:
```bash
opencode uninstall
```
The command shows what will be removed and asks for confirmation. See the [CLI reference](/docs/cli#uninstall) for options to keep your configuration or application data.
To remove OpenCode Desktop, uninstall the application through your operating system's app management tools.
---
## Desktop app
OpenCode Desktop runs a local OpenCode server (the `opencode-cli` sidecar) in the background. Most issues are caused by a misbehaving plugin, a corrupted cache, or a bad server setting.
### Quick checks
- Fully quit and relaunch the app.
- If the app shows an error screen, click **Restart** and copy the error details.
- macOS only: `OpenCode` menu -> **Reload Webview** (helps if the UI is blank/frozen).
---
### Disable plugins
If the desktop app is crashing on launch, hanging, or behaving strangely, start by disabling plugins.
#### Check the global config
Open your global config file and look for a `plugin` key.
- **macOS/Linux**: `~/.config/opencode/opencode.jsonc` (or `~/.config/opencode/opencode.json`)
- **macOS/Linux** (older installs): `~/.local/share/opencode/opencode.jsonc`
- **Windows**: Press `WIN+R` and paste `%USERPROFILE%\.config\opencode\opencode.jsonc`
If you have plugins configured, temporarily disable them by removing the key or setting it to an empty array:
```jsonc
{
"$schema": "https://opencode.ai/config.json",
"plugin": [],
}
```
#### Check plugin directories
OpenCode can also load local plugins from disk. Temporarily move these out of the way (or rename the folder) and restart the desktop app:
- **Global plugins**
- **macOS/Linux**: `~/.config/opencode/plugins/`
- **Windows**: Press `WIN+R` and paste `%USERPROFILE%\.config\opencode\plugins`
- **Project plugins** (only if you use per-project config)
- `<your-project>/.opencode/plugins/`
If the app starts working again, re-enable plugins one at a time to find which one is causing the issue.
---
### Clear the cache
If disabling plugins doesn't help (or a plugin install is stuck), clear the cache so OpenCode can rebuild it.
1. Quit OpenCode Desktop completely.
2. Delete the cache directory:
- **macOS**: Finder -> `Cmd+Shift+G` -> paste `~/.cache/opencode`
- **Linux**: delete `~/.cache/opencode` (or run `rm -rf ~/.cache/opencode`)
- **Windows**: Press `WIN+R` and paste `%USERPROFILE%\.cache\opencode`
3. Restart OpenCode Desktop.
---
### Fix server connection issues
OpenCode Desktop can either start its own local server (default) or connect to a server URL you configured.
If you see a **"Connection Failed"** dialog (or the app never gets past the splash screen), check for a custom server URL.
#### Clear the desktop default server URL
From the Home screen, click the server name (with the status dot) to open the Server picker. In the **Default server** section, click **Clear**.
#### Remove `server.port` / `server.hostname` from your config
If your `opencode.json(c)` contains a `server` section, temporarily remove it and restart the desktop app.
#### Check environment variables
If you have `OPENCODE_PORT` set in your environment, the desktop app will try to use that port for the local server.
- Unset `OPENCODE_PORT` (or pick a free port) and restart.
---
### Linux: Wayland / X11 issues
On Linux, some Wayland setups can cause blank windows or compositor errors.
- If you're on Wayland and the app is blank/crashing, try launching with `OC_ALLOW_WAYLAND=1`.
- If that makes things worse, remove it and try launching under an X11 session instead.
---
### Windows: WebView2 runtime
On Windows, OpenCode Desktop requires the Microsoft Edge **WebView2 Runtime**. If the app opens to a blank window or won't start, install/update WebView2 and try again.
---
### Windows: General performance issues
If you're experiencing slow performance, file access issues, or terminal problems on Windows, try using [WSL (Windows Subsystem for Linux)](/docs/windows-wsl). WSL provides a Linux environment that works more seamlessly with OpenCode's features.
---
### Notifications not showing
OpenCode Desktop only shows system notifications when:
- notifications are enabled for OpenCode in your OS settings, and
- the app window is not focused.
---
### Reset desktop app storage (last resort)
If the app won't start and you can't clear settings from inside the UI, reset the desktop app's saved state.
1. Quit OpenCode Desktop.
2. Find and delete these files (they live in the OpenCode Desktop app data directory):
- `opencode.settings.dat` (desktop default server URL)
- `opencode.global.dat` and `opencode.workspace.*.dat` (UI state like recent servers/projects)
To find the directory quickly:
- **macOS**: Finder -> `Cmd+Shift+G` -> `~/Library/Application Support` (then search for the filenames above)
- **Linux**: search under `~/.local/share` for the filenames above
- **Windows**: Press `WIN+R` -> `%APPDATA%` (then search for the filenames above)
---
## Getting help
If you're experiencing issues with OpenCode:
1. **Report issues on GitHub**
The best way to report bugs or request features is through our GitHub repository:
[**github.com/anomalyco/opencode/issues**](https://github.com/anomalyco/opencode/issues)
Before creating a new issue, search existing issues to see if your problem has already been reported.
2. **Join our Discord**
For real-time help and community discussion, join our Discord server:
[**opencode.ai/discord**](https://opencode.ai/discord)
---
## Common issues
Here are some common issues and how to resolve them.
---
### OpenCode won't start
1. Check the logs for error messages
2. Try running with `--print-logs` to see output in the terminal
3. Ensure you have the latest version with `opencode upgrade`
---
### Authentication issues
1. Try re-authenticating with the `/connect` command in the TUI
2. Check that your API keys are valid
3. Ensure your network allows connections to the provider's API
---
### Model not available
1. Check that you've authenticated with the provider
2. Verify the model name in your config is correct
3. Some models may require specific access or subscriptions
If you encounter `ProviderModelNotFoundError` you are most likely incorrectly
referencing a model somewhere.
Models should be referenced like so: `<providerId>/<modelId>`
Examples:
- `openai/gpt-4.1`
- `openrouter/google/gemini-2.5-flash`
- `opencode/kimi-k2`
To figure out what models you have access to, run `opencode models`
---
### ProviderInitError
If you encounter a ProviderInitError, you likely have an invalid or corrupted configuration.
To resolve this:
1. First, verify your provider is set up correctly by following the [providers guide](/docs/providers)
2. If the issue persists, try clearing your stored configuration:
```bash
rm -rf ~/.local/share/opencode
```
On Windows, press `WIN+R` and delete: `%USERPROFILE%\.local\share\opencode`
3. Re-authenticate with your provider using the `/connect` command in the TUI.
---
### AI_APICallError and provider package issues
If you encounter API call errors, this may be due to outdated provider packages. opencode dynamically installs provider packages (OpenAI, Anthropic, Google, etc.) as needed and caches them locally.
To resolve provider package issues:
1. Clear the provider package cache:
```bash
rm -rf ~/.cache/opencode
```
On Windows, press `WIN+R` and delete: `%USERPROFILE%\.cache\opencode`
2. Restart opencode to reinstall the latest provider packages
This will force opencode to download the most recent versions of provider packages, which often resolves compatibility issues with model parameters and API changes.
---
### Copy/paste not working on Linux
Linux users need to have one of the following clipboard utilities installed for copy/paste functionality to work:
**For X11 systems:**
```bash
apt install -y xclip
# or
apt install -y xsel
```
**For Wayland systems:**
```bash
apt install -y wl-clipboard
```
**For headless environments:**
```bash
apt install -y xvfb
# and run:
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 &
export DISPLAY=:99.0
```
opencode will detect if you're using Wayland and prefer `wl-clipboard`, otherwise it will try to find clipboard tools in order of: `xclip` and `xsel`.
|