pulumi/pulumi · error

Request to disable policy pack failed: %w

Error message

Request to disable policy pack failed: %w

What it means

Wraps any error from the REST call that disables a policy pack on an organization's policy group (PATCH updatePolicyGroupPath with a disable request).

Source

Thrown at pkg/backend/httpstate/client/client.go:2205

// it will disable the PolicyPack on the default PolicyGroup.
func (pc *Client) DisablePolicyPack(ctx context.Context, orgName string, policyGroup string,
	policyPackName, versionTag string,
) error {
	// If Policy Group was not specified, use the default Policy Group.
	if policyGroup == "" {
		policyGroup = apitype.DefaultPolicyGroup
	}

	req := apitype.UpdatePolicyGroupRequest{
		RemovePolicyPack: &apitype.PolicyPackMetadata{
			Name:       policyPackName,
			VersionTag: versionTag,
		},
	}

	err := pc.restCall(ctx, http.MethodPatch, updatePolicyGroupPath(orgName, policyGroup), nil, req, nil)
	if err != nil {
		return fmt.Errorf("Request to disable policy pack failed: %w", err)
	}
	return nil
}

// RemovePolicyPack removes all versions of a `PolicyPack` from the Pulumi organization.
func (pc *Client) RemovePolicyPack(ctx context.Context, orgName string, policyPackName string) error {
	path := deletePolicyPackPath(orgName, policyPackName)
	err := pc.restCall(ctx, http.MethodDelete, path, nil, nil, nil)
	if err != nil {
		return fmt.Errorf("Request to remove policy pack failed: %w", err)
	}
	return nil
}

// RemovePolicyPackByVersion removes a specific version of a `PolicyPack` from
// the Pulumi organization.
func (pc *Client) RemovePolicyPackByVersion(ctx context.Context, orgName string,
	policyPackName string, versionTag string,

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Check the wrapped error's HTTP status for the exact cause
  2. Confirm the pack/version is currently enabled on the policy group
  3. Verify org and policy group names
  4. Ensure your token has permission to modify org policy groups
Defensive patterns

Strategy: try-catch

Validate before calling

if !validVersionTag(versionTag) { return errors.New("invalid version tag") }

Try / catch

if err := client.DisablePolicyPack(ctx, org, pack, version); err != nil {
	// tolerate already-disabled packs
	if strings.Contains(err.Error(), "404") { return nil }
	return fmt.Errorf("disable %s@%s: %w", pack, version, err)
}

Prevention

When it happens

Trigger: Calling Client.DisablePolicyPack when the policy pack isn't currently enabled, the version tag is wrong, the org/policy group doesn't exist, or auth/permissions/network fail.

Common situations: Trying to disable a pack already removed from the policy group, insufficient org permissions, or a stale version tag after the pack was updated.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


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