crewAIInc/crewAI · error · SystemExit

No organisation set. Run `crewai org switch <org_id>` first,

Error message

No organisation set. Run `crewai org switch <org_id>` first, or pass --org.

What it means

Publishing needs an organization to scope the skill to. The effective org is `org` (from `--org`) or, falling back, `settings.org_name` from local CLI settings. When both are unset the CLI cannot determine the target namespace and exits, pointing at `crewai org switch`.

Source

Thrown at lib/cli/src/crewai_cli/skills/main.py:263

            console.print(
                "[red]SKILL.md frontmatter must include a 'name' field.[/red]"
            )
            raise SystemExit(1)

        if not version:
            console.print(
                "[red]SKILL.md frontmatter must include a 'version' field before publishing.[/red]"
            )
            raise SystemExit(1)

        settings = Settings()
        effective_org = org or settings.org_name
        if not effective_org:
            console.print(
                "[red]No organisation set. Run `crewai org switch <org_id>` first, "
                "or pass --org.[/red]"
            )
            raise SystemExit(1)

        self._print_current_organization()
        console.print(
            f"[bold blue]Publishing skill [bold]{name}[/bold] v{version} to {effective_org}...[/bold blue]"
        )

        archive_bytes = self._build_skill_tarball()
        encoded_file = "data:application/x-gzip;base64," + base64.b64encode(
            archive_bytes
        ).decode("utf-8")

        response = self.plus_api_client.publish_skill(
            org=effective_org,
            name=name,
            version=version,
            is_public=False,
            description=description,
            encoded_file=encoded_file,

View on GitHub (pinned to 754d7323be)

Solutions

  1. Run `crewai org switch <org_id>` once to persist the org in settings, then retry `crewai skill publish`.
  2. Or pass it per-invocation: `crewai skill publish --org <org_id>`.
  3. Verify with `crewai org show` (or equivalent status command) that an org is active before publishing.

Example fix

# before
crewai skill publish   # No organisation set.

# after
crewai org switch acme-prod
crewai skill publish
# or
crewai skill publish --org acme-prod
Defensive patterns

Strategy: validation

Validate before calling

import subprocess, json

def org_is_set() -> bool:
    settings = json.loads(subprocess.run(
        ["crewai", "org", "show"], capture_output=True, text=True
    ).stdout or "{}")
    return bool(settings.get("org_name"))

# guard: crewai org switch <org_id> unless org_is_set()

Prevention

When it happens

Trigger: Running `crewai skill publish` with no `--org` flag on a machine where `Settings().org_name` is empty — typically a fresh install, after logout, or after settings were reset/deleted (`~/.crewai` config cleared).

Common situations: First publish on a new workstation; CI runners with no persistent settings file; a team member who has never run any org command; settings file removed by a cleanup script.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/7fac36b0c1782ad3. Report an issue: GitHub.