# Troubleshooting a local setup

Fix a local Repowise setup with repowise doctor, then work through install failures, PATH problems, missing MCP tools, slow indexing and Windows issues.

Start with `repowise doctor`. It names the failing check and, for most of them,
fixes it. The sections below cover what it cannot fix on its own.

## Run `repowise doctor` first

```bash
repowise doctor
```

```bash
repowise doctor --repair
```

[`doctor`](https://docs.repowise.dev/cli/config#repowise-doctor) checks the git repository, the
`.repowise/` directory, the database, vector and full-text stores, the saved
provider settings, the Claude Code MCP entry and whether the MCP server
responds. It also compares your CLI against the latest release. `--repair`
fixes the mismatches it finds, re-registers a stuck Claude Code MCP entry and
refreshes the config of every wired agent. `--format json` gives a
machine-readable report and exits `1` when any check fails.

## Install fails

- **Python too old.** Repowise needs Python 3.11 or newer. Check with
  `python3 --version` (`python --version` on Windows). uv brings a suitable
  Python by itself, so `uv tool install repowise` works on any system Python.
- **No uv.** Install it from [docs.astral.sh/uv](https://docs.astral.sh/uv/),
  or use pipx or pip.
- **pip installs into the wrong environment.** Prefer `uv tool install` or
  `pipx install`, which keep Repowise in its own environment.

Full requirements: [Requirements](https://docs.repowise.dev/installation/requirements).

## `command not found: repowise`

The install location is not on `PATH`:

- **uv:** run `uv tool update-shell`, then open a new shell. `uv tool dir --bin`
  prints the directory.
- **pipx:** run `pipx ensurepath`, then open a new shell.
- **pip:** add the scripts directory under `python3 -m site --user-base` to
  `PATH` (`bin` on macOS and Linux, `Scripts` on Windows).

Check with `which repowise` (macOS and Linux) or `where repowise` (Windows).
The per-user Claude Code entry in `~/.claude.json` records the absolute path of
the install that wrote it, so it starts without `PATH`. `.mcp.json` and other
project configs start `repowise` by name and need it on `PATH`; restart the
host after fixing it.

## MCP tools do not show up in Claude Code

1. Restart Claude Code once, then run `/mcp` to confirm `repowise` is
   connected (approve the project server if asked). `claude mcp list` in a
   terminal shows the same.
2. Check `~/.claude.json` has a top-level `mcpServers.repowise` entry, or that
   the Repowise Claude Code plugin is enabled. A project `.mcp.json` exists only
   when the per-user entry does not serve this repository.
3. Run `repowise doctor`. It warns about an entry left in
   `~/.claude/settings.json`, which Claude Code does not read for MCP servers;
   `repowise doctor --repair` moves it.
4. Wire it again: `repowise agents add --target=claude-code --yes`.

If the agent uses `Grep` and `Read` instead of calling a Repowise tool, the
server is not connected. In a directory with no `.repowise/`, every tool
answers with a "run `repowise init`" notice: that project has no index yet.

## MCP tools do not show up in another host

| Host | Where to look |
|---|---|
| Codex | `/mcp`. No `repowise` listed: trust the project, then restart Codex |
| Cursor | Cursor Settings, MCP: a green dot. Ask in Agent mode; Ask mode does not call tools |
| VS Code (Copilot) | `MCP: List Servers` in the Command Palette. Ask in Copilot Chat's Agent mode |

Re-run the wiring with `repowise agents add --target=<id> --yes`, where
`<id>` is one of `claude-code`, `codex`, `cursor`, `vscode`, `opencode`,
`hermes`, `copilot`, `kiro` or `windsurf`, then restart the host.

## No API key set

`repowise init` does not need one. With no provider it renders the
documentation from your code's structure and exits `0`. To make sure no model
is called even when a key is set:

```bash
repowise init --yes --no-prose
```

`repowise generate`, `restyle` and `update` in docs mode need a provider. Every
key variable is on [Environment variables](https://docs.repowise.dev/installation/env-vars).

`REPOWISE_PROVIDER` and `REPOWISE_MODEL` apply only when no flag and no
`provider` or `model` in `.repowise/config.yaml` names one. An empty value is
treated as unset. The full order is on
[Environment variables](https://docs.repowise.dev/installation/env-vars#provider-model-and-base-url-order).

## Scripts and CI

An `init` prompt never blocks a script: when stdin is not a terminal, the first
prompt reads end of input and `init` continues with defaults, and the cost gate
declines on its own and keeps the documentation built from code. Use
`repowise init --yes --no-prose` in a script, and add `--no-editor-setup` so
only `.repowise/` is written.

## Indexing is slow or hangs

- **Minified bundles or build output checked in.** Repowise skips minified and
  generated files it detects, and honours every `.gitignore`, nested ones
  included. Exclude the rest: `repowise init -x '**/<build-output-dir>/**'`.
- **A parser fails on a generated file.** Exclude it:
  `repowise init -x 'src/generated/**'`.
- **Submodules.** Skipped by default; included only with
  `--include-submodules`.
- **A very large repository.** `repowise init --mode fast` builds an index only
  (graph and essential git) for a quick first pass.
- **Interrupted run.** `repowise init --resume` continues from where it stopped.

## Documentation feels stale after a big merge

```bash
repowise update --since main
```

`repowise init --force` regenerates everything. After a package upgrade, read
[Upgrading](https://docs.repowise.dev/upgrading) first.

## Search and database counts disagree

```bash
repowise doctor --repair
```

If that does not settle it, `repowise reindex` rebuilds the vector store from
the stored pages. It makes embedding calls only, no LLM calls.

## Windows

Set UTF-8 output before `init` if you see codec errors:

```powershell
$env:PYTHONIOENCODING = "utf-8"
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
repowise init
```

Use `python -m pip install repowise` in place of `python3 -m pip`, and
`where repowise` to find the binary.

> **Note**
>
> Still stuck? Capture the output of `repowise doctor --format json` and open an
> issue on [GitHub](https://github.com/repowise-dev/repowise/issues) or ask in
> [Discord](https://discord.gg/cQVpuDB6rh).

## Next
- [Hosted troubleshooting](https://docs.repowise.dev/hosted/troubleshooting) for repositories on repowise.dev.
- [What init writes](https://docs.repowise.dev/getting-started/what-init-writes) to see or undo every file.
- [Upgrading](https://docs.repowise.dev/upgrading) when a new version changes behaviour.
