Troubleshooting
This page starts from what you see: a line beginning with ✘, an error code in a JSON document, or a result that is not what you expected. Each entry gives the real message, the situations that raise it, and the fix. Every message quoted here was produced by the CLI on a deliberately broken setup of the acme example company.
Start with safran doctor
safran doctor checks, in order, everything the other commands depend on. Run it first; most entries on this page are one of its lines.
$ safran doctor --profile /work/acme/safran.yaml
✔ bun Bun 1.3.2
✔ git git version 2.50.1 (Apple Git-155)
✔ launch no .env or bunfig.toml in this directory for Bun to auto-load
✔ profile /work/acme/safran.yaml (acme): 1 tracker, 1 code host
✘ env JIRA_TOKEN not set (used by trackers.jira.token_env)
→ Export JIRA_TOKEN in your shell, or put it in the .env file next to the profile.
✔ embedder ollama:bge-m3 answered in 39 ms (1024 dimensions)
✔ repos 2 repos listed
✘ index 2 repos built with fake:hash-256, but the profile configures ollama:bge-m3: ledger, payments-api
→ Vectors of different models cannot be compared, so search refuses these repos. Re-index with `safran sync --profile /work/acme/safran.yaml`, or switch `embeddings:` back.
✔ links 3 pull requests, 2 with a ticket, refreshed just now
✘ 2 checks failed.A line is ✔ (fine), ! (a warning: something is missing but nothing is broken) or ✘ (a failure). The exit code is 1 when at least one check fails; warnings alone leave it at 0.
| Check | What it does | Fails or warns when |
|---|---|---|
bun | Compares the Bun version with the minimum, 1.3.0 | Bun is older |
git | Finds git on PATH and runs git --version | git is missing or does not run |
launch | Looks for a .env or bunfig.toml that Bun may have loaded from the directory you are in | Warns when one exists and the CLI was not started through bin/safran |
profile | Loads the profile and builds every connector | The file is missing, invalid, or a connector entry is wrong |
env <NAME> | One line per environment variable named by a *_env field | The variable is unset or empty |
embedder | Embeds one short text (60 second limit) | The embedding server is unreachable or returns no vector |
repos | Lists the repositories of the code hosts | Listing fails; warns when no host is configured or nothing is listed |
index | Reads the local index | Fails when repos were built with another embedder; warns when the index is not built, a sync did not finish, a listed repo is not indexed, or the oldest repo was indexed more than 7 days ago |
links | Reads the local ticket ↔ code store | Warns when it is empty and a code host could fill it |
safran status shows the same local state on one screen without calling any service; safran doctor is the one that contacts the embedder and the code hosts.
When everything is fine the last line reads:
$ safran doctor
✔ bun Bun 1.3.2
✔ git git version 2.50.1 (Apple Git-155)
✔ launch started through bin/safran: Bun loaded no .env or bunfig.toml from this directory
✔ profile safran.yaml (acme): 0 trackers, 1 code host
✔ environment the profile references no environment variables
✔ embedder ollama:bge-m3 answered in 33 ms (1024 dimensions)
✔ repos 2 repos listed
✔ index 2 repos, 4 chunks, embedder ollama:bge-m3, oldest index just now
✔ links not applicable: no code host in the profile lists pull requests
✔ Everything is in place.How errors are reported
Every failure Safran raises on purpose is a SafranError with a stable code, a message and, in most cases, a hint that says what to do next. The three surfaces show the same error differently:
| Surface | What you get |
|---|---|
| CLI | ✘ message on stderr, then → hint. The code is not printed in this form. |
CLI with --json | One JSON document on stdout: {"error": {"code", "message", "hint"}} (and problems for profile errors) |
| SDK | A thrown SafranError; branch on error.code (error handling) |
| MCP tool | A result with isError: true whose text is the message and the → hint line |
To see the code of a CLI error, add --json:
$ safran search "kısmi iade" --group mobile --json
{
"error": {
"code": "INVALID_INPUT",
"message": "Unknown repo group: mobile",
"hint": "Known groups: backend."
}
}Exit codes of the CLI:
| Exit code | Meaning |
|---|---|
0 | The command did its work. An empty result (No hits.) is still 0. |
1 | A failure: a SafranError, a failed doctor check, a repo that failed in safran sync |
2 | The command line is wrong: unknown command, unknown option, a value that is not allowed |
130 | Interrupted with Ctrl-C |
--verbose and where logs go
Safran writes no log file. Everything the libraries log goes to stderr, so stdout stays the command's own output and can be piped. Warnings are always printed (prefixed with !); --verbose adds the debug and info lines, and the stack trace of the underlying cause when a command fails.
$ safran sync --offline --verbose
ledger scanning files
debug Scanned repository (repo=ledger, files=1, git=false, skipped={})
ledger indexing 1/1 files 100%
info Indexed repository (repo=ledger, filesIndexed=0, filesUnchanged=1, filesRemoved=0, chunksWritten=0, embeddingsComputed=0, embeddingsCached=0, durationMs=16, filesSkipped={})
payments-api scanning files
debug Scanned repository (repo=payments-api, files=3, git=false, skipped={})
payments-api indexing 3/3 files 100%
info Indexed repository (repo=payments-api, filesIndexed=0, filesUnchanged=3, filesRemoved=0, chunksWritten=0, embeddingsComputed=0, embeddingsCached=0, durationMs=9, filesSkipped={})
repo status changed unchanged chunks time detail
✔ ledger ok 0 1 0 16 ms no changes
✔ payments-api ok 0 3 0 9 ms no changes
2 repos: 2 ok in 30 msTo keep a log, redirect stderr yourself, for example safran sync --verbose 2> sync.log. An error that is not a SafranError is shown as Unexpected error: … with the hint Run again with --verbose for the stack trace.
The MCP server over stdio follows the same rule: stdout carries protocol frames only and logs go to stderr, which is where your MCP client collects server logs. When a tool fails with an INTERNAL error, the agent only receives a reference (Internal error in <tool> (reference 1a2b3c4d)); the detail is logged under that reference on the server's stderr.
Error codes
| Code | Raised when | First thing to try |
|---|---|---|
PROFILE_INVALID | The profile file is missing, is not valid YAML, or fails the schema | safran profile check; see validation errors |
PLUGIN_NOT_FOUND | A connector type no plugin handles, or a module under plugins: that cannot be loaded or exports no plugin | safran plugins lists the types |
PLUGIN_CONFIG_INVALID | A connector entry has an unknown key or a wrong value; also the code of a combined report when several entries fail for different reasons | Fix the listed entries; safran plugins |
AUTH_MISSING | An environment variable named by a *_env field (or by --token-env) is unset or empty | Export it, or put it in the .env next to the profile |
AUTH_FAILED | A service answered 401 or 403, redirected to its sign-in page, or git was refused by the code host | Check the token's value, expiry and permissions |
NOT_FOUND | A ticket, repo, file, page or golden set that does not exist; a reference no tracker recognises; a 404 from a service | Check the name; safran repos, safran status |
FORBIDDEN | A local policy refused something the remote would have served: a profile's plugins: that are not trusted, a Confluence space or Azure Boards project outside the profile's allow-list | Follow the hint: name the profile, or extend the list |
UNSUPPORTED | The connector does not have the capability: tracker search or native queries, pull requests on a host, a doc URL no source recognises, code search turned off | Use another connector or another call |
RATE_LIMITED | A service answered 429 (or GitHub's rate limit) after the client's own retries | Wait and retry |
UPSTREAM | A service answered with another error or an unexpected shape, was unreachable, or git failed for a network reason; the embedder is down or lacks the model | Check the service and the network, then retry |
INVALID_INPUT | An argument is wrong: unknown group or tracker, empty query, ambiguous ticket reference, a path that leaves the repo, a binary or credentials file, a port that is taken | Read the hint; it names the accepted values |
INDEX_NOT_READY | The index holds vectors of another embedder, is locked by another Safran process, or was closed | safran sync (see below) |
INCOMPATIBLE_DATA | A file under the data directory (index, link store) or a golden set was written by a newer version, or is not a readable database | Upgrade, or delete the file and rebuild it |
ABORTED | The call was cancelled: Ctrl-C, an AbortSignal, a timeout, or close() | Run the command again; it continues |
INTERNAL | Anything unexpected: a bug, a broken plugin, a data directory that cannot be written, git not installed | --verbose for the stack trace |
The sections below show the messages you are most likely to meet.
PROFILE_INVALID
No profile where Safran looked (the default is ./safran.yaml, or $SAFRAN_PROFILE, or --profile):
$ safran status
✘ Profile not found: /work/acme/safran.yaml
→ Create one with `safran init`, or copy safran.example.yaml to safran.yaml.A profile that fails the schema lists every problem with its path. Here languages.code is missing:
$ safran sync --profile /work/acme/safran.yaml
✘ /work/acme/safran.yaml is not a valid profile:
- languages.code: Invalid input: expected string, received undefined
→ Compare with safran.example.yaml, or run `safran profile check`.Fix the listed paths and run safran profile check until it prints is valid. The profile reference has every field.
PLUGIN_NOT_FOUND and PLUGIN_CONFIG_INVALID
Connector entries are checked together when the instance is built, so you see all of them at once. A mistyped type:
$ safran status --profile /work/acme/safran.yaml
✘ The profile has 1 configuration problem:
- embeddings: No embedder plugin handles type "olama" (Available embedder types: ollama, openai-compatible.)
→ Fix these entries in the profile. `safran plugins` lists the available types and their fields.A mistyped key (connector schemas are strict; unknown keys fail):
$ safran status --profile /work/acme/safran.yaml
✘ The profile has 1 configuration problem:
- embeddings: Unrecognized key: "modle"
→ Fix these entries in the profile. `safran plugins` lists the available types and their fields.A module under plugins: that cannot be found reports Could not load plugin module "./plugins/acme-tracker.ts": … with the hint Entries under plugins: are package names or paths relative to the profile file. Paths are resolved against the directory of the profile, not the directory you are in.
FORBIDDEN: plugins of a profile you did not name
$ safran status
✘ safran.yaml lists plugin modules (./plugins/acme-tracker.ts), and it was picked up from the current directory, not named by you
→ Plugin modules run as code on this machine. If you trust this profile, name it (--profile safran.yaml) or pass --allow-plugins; otherwise remove its `plugins:` entries.A safran.yaml that merely happens to be in the working directory may not make Safran import code. If the profile is yours, name it with --profile (or SAFRAN_PROFILE), or pass --allow-plugins. The reasoning is in the security guide.
AUTH_MISSING and AUTH_FAILED: token missing or token rejected
These are two different problems with two different fixes.
Missing means Safran never sent a request: the variable the profile names is not set.
$ safran ticket PAY-1423 --profile /work/acme/safran.yaml
✘ Environment variable JIRA_TOKEN is not set
→ Export JIRA_TOKEN in your shell, or put it in the .env file next to the profile.Connectors read their secret on first use, not when they are built. That is why safran profile check passes with a missing token and only reports it:
$ safran profile check --profile /work/acme/safran.yaml
✔ /work/acme/safran.yaml is valid
company acme
languages tickets tr, code en
trackers jira
code hosts azure (azure-repos)
doc sources none
groups backend (2) — 2 repos
teams none
glossary 0 terms
conventions 0
embeddings ollama (bge-m3)
data /work/acme/data
Environment variables
name status used by
AZURE_DEVOPS_PAT set code.hosts.azure.token_env
JIRA_EMAIL set trackers.jira.email_env
JIRA_TOKEN not set trackers.jira.token_env
! JIRA_TOKEN is not set; the connectors that use it will fail when called.
→ Export them in your shell, or put them in a .env file next to the profile.
Connectors were built, not called. `safran profile check --online --profile /work/acme/safran.yaml` makes one call to each.Things to check: the name in the profile and in the environment are spelled the same; the .env file sits next to the profile (not in the directory you run from); a variable that is set in the shell, even to an empty string, is never overridden by the .env file, and an empty value counts as not set.
Rejected means the service answered and said no. The HTTP client maps 401 to <service> 401 at <url>: the token was rejected (hint: Check that the token for <service> is valid and not expired.) and 403 to <service> 403 at <url>: access denied (hint: The <service> token is valid but lacks permission for this resource.). Some services answer with a sign-in page instead of a status code; the connectors report that as AUTH_FAILED too, for example Azure DevOps answered with its sign-in page instead of data: the token was rejected. During safran sync, a host that rejected the credentials once is not asked again for its other repos: they are reported as Not attempted: code host "azure" already rejected the credentials.
safran profile check --online makes one cheap call per connector and is the quickest way to tell the two apart. See secrets for how tokens are named and loaded.
UPSTREAM: the embedder is not reachable
$ safran sync --profile /work/acme/safran.yaml
repo status changed unchanged chunks time detail
✘ ledger failed – – – – Cannot reach Ollama at http://127.0.0.1:9
✘ payments-api failed – – – – Cannot reach Ollama at http://127.0.0.1:9
2 repos: 0 ok, 2 failed in 3.1 s
✘ ledger: Cannot reach Ollama at http://127.0.0.1:9 (UPSTREAM)
→ Start it with `ollama serve`, or set `embeddings.url` in the profile.
✘ payments-api: Cannot reach Ollama at http://127.0.0.1:9 (UPSTREAM)
→ Start it with `ollama serve`, or set `embeddings.url` in the profile.
✘ 2 repos failed. The others are indexed; fix the cause and run `safran sync --profile /work/acme/safran.yaml` again.A model that was never pulled fails the same way with Ollama does not have the model "acme-embed" and the hint Run: ollama pull acme-embed. A batch command such as safran sync never fails as a whole because one repo failed: each repo has its own status, the code is shown in parentheses, and the exit code is 1. See the Ollama connector.
INCOMPATIBLE_DATA
The index and the link store carry a schema version. A file written by a newer Safran is refused rather than misread; the hint says which file to delete. Everything under the data directory can be deleted and rebuilt with safran sync and safran links refresh (keeping the index fresh). A golden set of another version must be rebuilt with safran eval golden: results from different versions are not comparable.
ABORTED
Ctrl-C prints Interrupted with the hint Nothing is left half-written: run the command again to continue. and exits with 130. safran sync and safran links refresh are different: they stop cleanly and still print their report, with the repos that were not reached marked skipped.
Symptoms
Search returns nothing
safran search prints No hits. with exit code 0, and the line under it tells you which case you are in.
The index was never built.
$ safran search "kısmi iade" --profile /work/acme/safran.yaml
No hits.
→ The index is empty. Build it with `safran sync --profile /work/acme/safran.yaml`.Run safran sync. safran status shows index ! not built yet in the same situation.
The filters are too narrow.
$ safran search "kısmi iade" --repo payment-api --profile /work/acme/safran.yaml
No hits.
→ 4 chunks are indexed. Drop filters, try other words, or use `safran grep` for an exact string.Here the repo name is misspelled (payment-api instead of payments-api). In this version an unknown name in --repo or --lang is not an error for search: it simply matches nothing. Check the names with safran repos, and drop --repo, --group and --lang one at a time.
The group is unknown. Unlike a repo name, an unknown group is refused:
$ safran search "kısmi iade" --group mobile --profile /work/acme/safran.yaml
✘ Unknown repo group: mobile
→ Known groups: backend.Groups come from code.groups in the profile; add the group there or use one of the listed names.
The words are not the words of the code. A Turkish query over English code relies on the glossary and on the dense channel. If lexical search (--mode lexical) finds nothing for a Turkish word, that is expected; see non-English tickets. For an exact identifier, safran grep is the right tool.
safran sync, by contrast, does refuse an unknown repo name before it starts any work:
$ safran sync payment-api --profile /work/acme/safran.yaml
✘ No repo named "payment-api"
→ Did you mean: payments-api?Search fails after changing the embedding model
$ safran search "kısmi iade" --profile /work/acme/safran.yaml
✘ The code index holds vectors from "fake:hash-256" but the configured embedder is "ollama:bge-m3" (repositories: ledger, payments-api)
→ Run `safran sync` to re-index these repositories with the configured embedder, or configure the embedder they were built with. Until then only lexical search (mode "lexical"), grep and reading files work.Vectors from two embedding models cannot be compared, so the index records which embedder built each repo and refuses to mix them. This appears after you change embeddings.type or embeddings.model. (In this example the index had been built with the test embedder fake:hash-256 before the profile was switched to ollama:bge-m3; with two real models the message names those instead.) Two ways out:
- Run
safran sync. Every chunk of the affected repos is embedded again with the configured model; how long that takes depends on the model and the hardware. - Put
embeddings:back to what the index was built with.
Until then, safran search --mode lexical, safran grep and safran read keep working, because they need no vectors. safran status shows the same state as index ✘ 2 repos built with another embedder than ollama:bge-m3.
Other messages under the same code:
| Message | Meaning | Fix |
|---|---|---|
The index holds 1024-dimensional vectors but the embedder returned 768 | The model changed under the same name, so the embedder id did not | Delete the index directory under the data directory and run safran sync |
The code index is locked by another Safran process | Another command (a running safran sync, for example) holds the database | Wait for it to finish, then retry |
The code index is closed | The instance was closed while the call was running | Run the command again; restart a long-running server |
Ticket reference not recognised, or ambiguous
A reference is offered to every tracker in the profile; each one says whether the text has the shape of its tickets.
$ safran ticket 1423 --profile /work/acme/safran.yaml
✘ No tracker recognises "1423" as a ticket reference
→ Configured trackers: jira (PAY).NOT_FOUND here means no tracker accepted the shape. Pass what you would paste: a full key (PAY-1423) or the ticket's URL. With the explicit form <trackerId>:<ref> only that tracker is asked:
$ safran ticket jira:XX --profile /work/acme/safran.yaml
✘ Tracker "jira" does not recognise "XX" as one of its tickets
→ Configured trackers: jira (PAY).A well-formed key that does not exist is a different NOT_FOUND, raised by the tracker itself after it was asked (Ticket PAY-9999 not found in jira in this setup).
When two trackers accept the same shape (a Jira and a Linear entry both read PAY-1423), the profile decides: the tracker that lists the project under projects owns it. If none or several do, the call fails with INVALID_INPUT: "PAY-1423" could belong to several trackers: jira, linear, and the hint Say which one with "<trackerId>:<ref>", e.g. "jira:PAY-1423", or list the project under one tracker's projects in the profile. Listing each project under exactly one tracker removes the ambiguity for good; see multiple sources.
Sync says skipped
A repo is skipped when this run did not index it and nothing went wrong. The detail column and the lines under the table say why:
| Detail | Meaning | What to do |
|---|---|---|
Another sync is working on this repo (process …, since …). It was left alone; sync again once that one has finished. | Another safran sync (in this or another process) holds the repo's lock | Wait for the other run, then sync again |
not indexed (--fetch-only) | You asked for fetching only | Nothing; run safran sync without the flag to index |
not reached | The run was interrupted before this repo was reached. The same text is shown for a local host under --fetch-only, where there is nothing to fetch | Run safran sync again; it continues where it stopped |
An interrupted run says so under the table (Interrupted. Repos marked skipped were not reached; …) and exits with 130. A failed repo is different: it carries an error code and a hint, and the other repos are still indexed. More in keeping the index fresh.
links refresh says not applicable
$ safran links refresh --profile /work/acme/safran.yaml
No repo to refresh: none of the code hosts lists pull requests.
→ Ticket ↔ code links come from merged pull requests on azure-repos, github or gitlab hosts.The ticket ↔ code store is filled from merged pull requests. A local host reads directories in place and has no pull requests, so there is nothing to read; safran doctor and safran status then show not applicable: no code host in the profile lists pull requests, which is not a failure. Code search, grep and reading files are unaffected. Work history (safran links show, discovery and evaluation, which are built on it) needs an azure-repos, github or gitlab host.
If a host that does list pull requests reports History not fully fetched yet for …, run safran links refresh again: it resumes.
Tools appear twice in Claude Code
The Safran server was registered twice: once by the plugin and once by hand with claude mcp add. The plugin's tools are named mcp__plugin_safran_safran__<tool>, a hand-registered server's mcp__safran__<tool>; with both enabled the agent sees every tool two times. Keep one: either use the plugin, or remove it and keep the standalone server.
MCP server not listed
Check with /mcp in Claude Code. If safran is missing or failed, the server process did not start. What the repository's wiring establishes:
- The plugin's
profileoption must be an absolute path. The server is started with the Safran checkout as its working directory, so a relative path is looked up there and the profile is not found. - The plugin starts the server with the
buncommand, sobunmust be on thePATHof the process that launches Claude Code. - A profile that does not load stops the server before it serves anything. Run the same command yourself to read the error on stderr:
safran mcp --profile /work/acme/safran.yamlIf it prints an error from this page (Profile not found, is not a valid profile, a configuration problem), fix that first. If it stays silent and waits, the server is healthy (stop it with Ctrl-C) and the registration is what needs checking.
A missing token does not keep the server from starting: connectors read secrets on first use, so the server is listed and the first ticket tool returns AUTH_MISSING. The .env file next to the profile is read; a .env in your project is not.
For the HTTP transport, two refusals happen at start-up. Binding a non-loopback address without a token is a usage error (exit code 2):
$ safran mcp --http --host 0.0.0.0
✘ Refusing to bind 0.0.0.0 without a token
→ The server gives read access to your tickets and source code and has no other authentication. Keep the default 127.0.0.1, or name a variable holding a bearer token: --token-env SAFRAN_MCP_TOKENA port that is taken reports Could not listen on 127.0.0.1:3939: … (INVALID_INPUT) with the hint to choose another with --port, or --port 0 for any free one. See MCP over HTTP.
A command or option is not recognised
Usage errors exit with 2 and suggest the closest name. Typing serch for search:
✘ Unknown command "serch"
→ Did you mean `safran search`?A mistyped option is answered the same way (Unknown option --lmit, then Did you mean --limit?). Every command prints its options and an example with --help.
Still stuck
Collect these three things before asking for help; none of them contains a token:
- The output of
safran doctor(it prints variable names and whether they are set, never values). - The failing command with
--json, for the error code. - The same command with
--verbose, with stderr saved to a file.