## TL;DR

Set SENTRY\_ORG and SENTRY\_PROJECT explicitly in CI rather than relying on config files, and pass --org/--project explicitly in scripts that touch multiple projects. The CLI resolves org/project from, in precedence order: 1.

## Steps

1. The CLI resolves org/project from, in precedence order:

2. Explicit flags: `--org`/`-o`, `--project`/`-p`
2. Env vars: `SENTRY_ORG`, `SENTRY_PROJECT`
3. `.sentryclirc` `[defaults]` section (found by searching upward from cwd, plus `~/.sentryclirc`)
4. `.properties` files via `SENTRY_PROPERTIES`

3. A stale `.sentryclirc` in a home directory or repo root silently overrides what you think you exported. When scope looks wrong, print the resolution: check env first, then look for `.sentryclirc` files upward from the working directory.

4. Set `SENTRY_ORG` and `SENTRY_PROJECT` explicitly in CI rather than relying on config files, and pass `--org`/`--project` explicitly in scripts that touch multiple projects. Re-run `sentry-cli info` and confirm the org slug matches the URL you see in sentry.io. Slugs are not names: the slug is the URL-safe identifier in settings, and using the display name fails.

## When to use

You are seeing this: Commands fail with not-found or permission errors even though the auth token works (sentry-cli info succeeds). Use this skill when you run into "Sentry: sentry-cli fails on org or project scope".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.
