pulumi/pulumi · error

organization name must not contain slashes

Error message

organization name must not contain slashes

What it means

`pulumi policy publish` accepts an organization name as the publish target; because the policy pack reference is built as '<orgName>/', a slash inside the org name would produce a malformed pack reference. The CLI rejects any org name containing '/' before constructing it.

Source

Thrown at pkg/cmd/pulumi/policy/policy_publish.go:99

	if len(args) > 0 {
		orgName = args[0]
	} else if len(args) == 0 {
		org, err := b.GetDefaultOrg(ctx)
		if err != nil {
			return err
		}
		orgName = org
	}

	//
	// Construct a policy pack reference of the form `<org-name>/<policy-pack-name>`
	// with the org name and an empty policy pack name. The policy pack name is empty
	// because it will be determined as part of the publish operation. If the org name
	// is empty, the current user account is used.
	//

	if strings.Contains(orgName, "/") {
		return errors.New("organization name must not contain slashes")
	}
	policyPackRef := orgName + "/"

	//
	// Obtain current PolicyPack, tied to the Pulumi Cloud backend.
	//

	policyPack, err := requirePolicyPackForBackend(ctx, policyPackRef, b)
	if err != nil {
		return err
	}

	//
	// Load metadata about the current project.
	//

	pwd, err := cmd.getwd()
	if err != nil {

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Pass only the org name: `pulumi policy publish my-org`
  2. Strip any path components from your variable before invoking (e.g. `${org%%/*}` in bash)
  3. Publish without arguments to derive the org from the project/config instead
  4. Validate org names in scripts with a check like `[[ $org != */* ]]`

Example fix

// before
pulumi policy publish my-org/mypack
// after
pulumi policy publish my-org
Defensive patterns

Strategy: validation

Validate before calling

[[ "$ORG" != */* ]] || { echo "organization name must not contain slashes: $ORG"; exit 1; }

Try / catch

if err := cmd.Run(); err != nil {
	if strings.Contains(err.Error(), "must not contain slashes") {
		// strip path components from the org argument and retry
	}
}

Prevention

When it happens

Trigger: `pulumi policy publish <org>/<something>` — passing a fully-qualified path-like value, a URL fragment, or an accidental paste like 'my-org/policy' instead of just the organization name.

Common situations: Copy-pasting a full policy pack reference or URL into the org argument; confusing `pulumi policy publish <org>` with commands that take '<org>/<pack>' style arguments; scripting with variables that contain trailing path components.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/c24e516a1d86b633. Report an issue: GitHub.