# Troubleshooting

Start with:

```bash
kurama doctor
```

It prints the version, platform, detected browsers and whether they are running,
winget availability, config and log paths, bundled uBlock Origin manifest,
wallpaper size, and a list of problems. Add `--json` when asking for help.

## The GUI does not open

**Nothing happens when I double-click the Windows executable.**
The GUI build has no console window, so errors are not visible. Run the console
build or `kurama-cli.exe doctor` from a terminal. A common cause is antivirus
quarantining the unsigned executable; check its quarantine history. SmartScreen
may also require **More info → Run anyway** on first launch.

**A browser opens but the page is blank.**
Open the launcher URL printed by `kurama serve`, not the base URL. The base URL
has no session cookie until the token in the launcher URL is exchanged. If the
page was opened from browser history, the token is gone; start kurama again.

**The port is in use.**
kurama chooses a free port by default. If you forced `--port`, choose another:
`kurama serve --port 18766 --json`.

**The server starts but the page cannot connect.**
The default bind address is `127.0.0.1`. Do not change it to `0.0.0.0`: the
server rejects foreign Host headers, and exposing it is unsafe. A local firewall
or proxy that intercepts loopback can also break the connection; allow the
executable on private/loopback traffic.

**`kurama: web server: listen ... address already in use`**
Another kurama instance is still running. Close it, or let the default random
port pick a new one.

## No browser found

`kurama detect` lists supported browsers and their official download links.
Firefox can be installed with:

```powershell
kurama install --yes
```

That uses winget. If winget is unavailable, install Firefox from
<https://www.mozilla.org/firefox/> and run `kurama detect` again.

Forks (LibreWolf, Waterfox, Floorp, Zen, Mullvad Browser, Pale Moon, Tor Browser)
are detected but not installed by kurama. Use the link that `detect` prints.

If a browser is installed in a non-standard place, detection may miss it. Set
`KURAMA_TEST_FIREFOX` only for tests; the product uses known install locations
and the Windows registry. A portable Firefox is not currently supported.

## The browser is running

Firefox rewrites `profiles.ini` and profile files on exit. kurama refuses to
modify a running profile so the change cannot be lost or corrupted.

Close every window, including background processes:

```powershell
Get-Process firefox -ErrorAction SilentlyContinue | Stop-Process
```

Then run kurama again. `kurama doctor` shows whether each installed browser is
running.

## Profile questions

**I do not see my old bookmarks or settings.**
A new profile is a separate browser identity. Your old profile still exists.
Open `about:profiles` in Firefox to switch back, or re-run kurama choosing
**Use an existing profile**. Bookmarks are not copied between profiles unless
you import an export.

**Firefox opens the wrong profile.**
kurama marks a new profile as default by updating `profiles.ini`, but Firefox
can override that with `profiles.ini`'s last-used profile or a command-line
`-P`. Open `about:profiles` and choose **Set as default profile**, or launch with
`-P kurama`.

**The profile name already exists.**
kurama picks a unique name such as `kurama 2` rather than overwriting. Run
`kurama profiles --browser firefox` to see what exists.

**I chose the wrong existing profile.**
Run `kurama restore --browser firefox --profile <name> --yes` to restore the
newest backup. Only kurama-managed files are restored.

## Add-on installation

**I get a warning that automatic add-on installation is unavailable.**
The core setup still succeeded. kurama opened the store pages instead. Check
`kurama doctor` first, then run once with diagnostics:

```bash
KURAMA_WEBDRIVER_VERBOSE=1 kurama apply --profile test --addons clearurls --yes
```

On Windows PowerShell:

```powershell
$env:KURAMA_WEBDRIVER_VERBOSE = "1"
kurama apply --profile test --addons clearurls --yes
```

kurama extracts the bundled geckodriver into the user cache on first use. A
read-only cache, antivirus quarantine, or an unsupported CPU architecture can
block that. `KURAMA_DRIVER_CACHE` moves the cache, and `KURAMA_GECKODRIVER` points
at an existing driver:

```powershell
$env:KURAMA_GECKODRIVER = "C:\Tools\geckodriver.exe"
kurama apply --profile test --addons clearurls --yes
```

**It hangs on the first add-on.**
The first run extracts the driver and starts Firefox with a fresh profile, which
can be slow on older machines. The whole install allows six minutes. To watch it,
show the browser window:

```powershell
$env:KURAMA_WEBDRIVER_VERBOSE = "1"
$env:KURAMA_WEBDRIVER_HEADLESS = "0"
kurama apply --profile addon-test --addons clearurls --yes
```

The visible Firefox window should show a blank/new-tab session, not your normal
profile.

**`geckodriver exited before it was ready` or `geckodriver did not become ready`.**
Close every Firefox window, including forks, and retry. A stale process holding
the profile or a firewall blocking loopback connections can cause this. If a
system driver is at fault, remove it from `PATH`; the bundled driver is preferred
already. Antivirus software sometimes blocks a freshly extracted executable, in
which case allow the `<cache>/kurama/drivers` folder.

**One add-on fails but others install.**
That is the designed fallback. The failed add-on's page opens in the browser;
finish it with **Add to Firefox**. The result screen and warnings name the
add-on.

**uBlock Origin does not appear.**
It is installed from the bundled XPI and needs no driver. Check `kurama doctor`
for the bundled manifest. Confirm the profile's `extensions` folder contains
`uBlock0@raymondhill.net.xpi`. Firefox may require a restart before the toolbar
icon appears.

**A password manager add-on is installed but cannot connect.**
Some add-ons need a desktop companion (KeePassXC) or a signed-in account. That
is outside kurama's scope.

## Network and blocked downloads

If add-on downloads fail on a school or corporate network, the error includes
the AMO URL and HTTP status. kurama falls back to opening the store page, where
the browser's own proxy settings apply. A TLS-inspecting proxy can interfere with
Firefox's own connection too; the store-page fallback avoids any driver-side
download entirely.

DoH mode 2 falls back to the system resolver, so a blocked Quad9 resolver should
not leave the browser without DNS. If you manually changed the mode to 3, revert
it to 2 or remove the custom `network.trr.*` prefs.

## Preferences did not change

1. Confirm Firefox was fully closed before the run.
2. Open `about:profiles` and check which profile is actually open.
3. Inspect `user.js` in the profile folder. It should start with a kurama header
   and contain the selected bundles.
4. Restart Firefox. `user.js` is applied on every launch, overwriting matching
   values in `prefs.js`.
5. If you edited `about:config` after running kurama, Firefox may have written a
   different value to `prefs.js`. Re-run kurama or change it again in
   `about:config`.

Some prefs are intentionally absent because the selected option was off. Check
the review summary or `kurama apply --dry-run --json`.

## Wallpaper is not visible

- Confirm `toolkit.legacyUserProfileCustomizations.stylesheets` is `true` in
  `about:config` and restart Firefox.
- Confirm `chrome/userContent.css` exists in the open profile's folder.
- The style targets `about:home` and `about:newtab` only. It does not theme
  normal pages.
- A custom image must be JPEG, PNG, WebP, GIF, or AVIF.
- If the browser was open during the run, close and reopen it.

A Firefox redesign can change the new-tab DOM. The wallpaper is cosmetic and
never affects normal browsing.

## Restore

```bash
kurama restore --browser firefox --profile kurama --yes
kurama restore --backup <folder> --yes
```

Backups live under `<profile>/.kurama/backups/<timestamp>/`. Restore refuses to
run while the browser is open. It restores only kurama-managed files and removes
files that did not exist before the backed-up run.

If no backup exists, the profile was never changed by kurama. Deleting a
kurama-created profile manually is possible with Firefox's `about:profiles`
**Remove** button; kurama does not delete profiles itself.

## Logs and configuration

| Data | Typical Windows path |
| --- | --- |
| Config | `%APPDATA%\kurama\config.json` |
| Logs | `%LOCALAPPDATA%\kurama\logs\` |
| Integration test override | `KURAMA_CONFIG_DIR` |

Logs are diagnostic only. Delete `config.json` to reset the theme and last
selection; kurama recreates it. A corrupt config is ignored with defaults.

Logs never contain browsing data. Add-on installation log lines may contain
local file paths and AMO URLs; review them before sharing.

## Linux and macOS

- The same binary works; there is no separate GUI package.
- On Linux, desktop shortcuts are `.desktop` files. Some desktop environments
  require marking them executable or allowing launch; kurama sets the executable
  bit where possible.
- Flatpak Firefox is launched through `flatpak run <app-id>`. If detection finds
  the Flatpak but launching fails, confirm the app ID with `flatpak list`.
- macOS shortcut creation is not offered. Use `about:profiles`.
- If the binary is downloaded with a quarantine attribute on macOS, allow it in
  **System Settings → Privacy & Security** or remove the attribute yourself.

## Getting help

Collect:

1. `kurama version`
2. `kurama doctor --json`
3. The exact command or steps you used.
4. The relevant log lines, with personal paths removed.

Open an issue at <https://codeberg.org/farba/kurama/issues>. Never attach a
Firefox profile archive or `prefs.js` without reviewing it first; they can
contain personal data.
