Your license enumerates every organization you belong to. If that is only one,
the CLI acts as that organization automatically and this page does not apply
to you. If it is more than one, restore and analyze need to know which
organization's rule profiles, entitlements, and namespace they should act
under for the current run.
How the CLI picks an organization
The CLI resolves the acting organization in this order and stops at the first match:
org: <slug>in the hierarchically resolved.codecharter/config.yml(the value closest to the file being analyzed wins, per the usual config hierarchy). See Configuration file.- The
CODECHARTER_ORGenvironment variable, iforg:is not set. - Your license's sole organization, if it covers exactly one. This is
the zero-configuration case and needs no
org:or environment variable at all. - If none of the above resolves an organization and your license covers more
than one, the CLI stops with an error and exit code
64, naming every organization your license covers and how to choose one.
# .codecharter/config.yml
org: vistron
profiles:
- dotnet-rules@^2
# equivalent, without editing config.yml
export CODECHARTER_ORG=vistron
codecharter analyze MySolution.sln
If you name an organization that your license does not cover — a typo, or an
organization you have since left — the CLI stops with exit code
6 and tells you which organizations the license
does carry. Run codecharter update to refresh your license after joining a
new organization; a cached license only reflects the memberships it was
issued with.
Why this only shows up for multi-organization licenses
A single-organization license carries an implicit, unambiguous organization,
so there is nothing to choose and the CLI proceeds exactly as before. The
moment a second organization appears on your license — for example after
being added to a second team — any command that needs to know "which
organization's rules and quota apply here" becomes ambiguous unless you say
so. This typically surfaces on the next CI run after being added to a second
organization, before you have set org: anywhere: gate the config or the
environment variable as part of onboarding to a second organization to avoid
a broken build.
Profile references and organizations
A profile reference without a namespace (dotnet-rules@^2) resolves inside
your currently selected organization. A namespaced reference
(vistron/dotnet-rules@^2) can point at a different organization's profile
than the one you are acting as; the CLI verifies your live membership in that
organization before serving the profile, so access reflects your current
memberships rather than what was true when your license was issued.
Exit codes
| Code | Meaning |
|---|---|
64 |
Your license covers more than one organization and none was selected via org: or CODECHARTER_ORG. |
6 |
An organization was named (via org: or CODECHARTER_ORG) that your license does not cover. See License File. |
See the full table on Exit Codes.