All docs
docs / reference
FAQ and troubleshooting
Troubleshooting and common questions.
On this page
Troubleshooting
| Symptom | Likely cause and fix |
|---|---|
| Results stay at 0 for every arm | Check the Problems panel or run npx petri-check .: PETRI012 (events going to Flagsmith Cloud), PETRI011 (no event storage) or PETRI007 (events disabled) |
| "collecting" forever | Flagsmith needs at least 50 identities and 5 conversions per arm before it reports inference |
| An arm in the results you never created | PETRI009, a phantom arm: something sent $flag_exposure with the served value instead of the variant key |
| The sidebar says "Connect" | No key found. Run Petri: Connect to Flagsmith, or check flagsmith.json / flagsmith.env (Configuration) |
| Status bar shows an error | Hover it. Usually a wrong API URL (it should end in /api/v1) or a revoked key |
petri-check exits with code 2 |
It couldn't read Flagsmith at the URL it names. Check --api-url and the key, or drop the key to run the code-only rules |
| The copilot says the key was rejected | Run Petri: Set Anthropic API Key again |
| Recompute fails with 429 | Flagsmith allows one recompute every few minutes. The last computed results stay valid; try again shortly |
Questions
Does it work with Flagsmith Cloud?
Yes. Connect to https://api.flagsmith.com with an organisation API key. PETRI012 (events sent to Cloud from a self-hosted SDK) doesn't apply there; the other eleven work the same.
Which SDKs and languages does it understand?
The scanner finds flag reads, exposures and events in JavaScript and TypeScript (Node, browser, React hooks), Python, Go, Ruby, Java, Kotlin, Swift, Dart, PHP, C#, Rust, Vue and Svelte files: getExperimentFlag, getValue, hasFeature, isFeatureEnabled, getFlag, useFlags, trackEvent, trackExposureEvent and their snake_case and PascalCase forms. The SDK-initialisation checks (PETRI007, PETRI008, PETRI012) look at new Flagsmith({...}) and flagsmith.init({...}).
Does anything leave my machine?
The extension talks to the Flagsmith you connect to, and the copilot (only if you set a Claude key) sends the conversation and the files it reads to Anthropic's API. The online playground runs in your browser: the code you paste never leaves the page. Petri collects no telemetry.
Can the copilot change production without me?
No. Every Flagsmith write and every code change waits for your approval in a modal that shows the exact request or diff, and every decision is logged in .petri/audit.jsonl. The MCP server is read-only. See Copilot and MCP server.
Why does Petri compute its own sample-ratio p-value?
Because Flagsmith returns none while an experiment runs (Flagsmith#9128), and a broken split makes every other number meaningless. See The decision rule.
Can I add a rule?
Yes. Rules live in extension/src/insights.ts (pure functions, no VS Code import) with tests in extension/test/. The contribution guide walks through adding one.