{"record":{"id":"03b1f31b08865b8d","repo":"pulumi/pulumi","slug":"request-to-disable-policy-pack-failed-w","errorCode":null,"errorMessage":"Request to disable policy pack failed: %w","messagePattern":"Request to disable policy pack failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/backend/httpstate/client/client.go","lineNumber":2205,"sourceCode":"// it will disable the PolicyPack on the default PolicyGroup.\nfunc (pc *Client) DisablePolicyPack(ctx context.Context, orgName string, policyGroup string,\n\tpolicyPackName, versionTag string,\n) error {\n\t// If Policy Group was not specified, use the default Policy Group.\n\tif policyGroup == \"\" {\n\t\tpolicyGroup = apitype.DefaultPolicyGroup\n\t}\n\n\treq := apitype.UpdatePolicyGroupRequest{\n\t\tRemovePolicyPack: &apitype.PolicyPackMetadata{\n\t\t\tName:       policyPackName,\n\t\t\tVersionTag: versionTag,\n\t\t},\n\t}\n\n\terr := pc.restCall(ctx, http.MethodPatch, updatePolicyGroupPath(orgName, policyGroup), nil, req, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Request to disable policy pack failed: %w\", err)\n\t}\n\treturn nil\n}\n\n// RemovePolicyPack removes all versions of a `PolicyPack` from the Pulumi organization.\nfunc (pc *Client) RemovePolicyPack(ctx context.Context, orgName string, policyPackName string) error {\n\tpath := deletePolicyPackPath(orgName, policyPackName)\n\terr := pc.restCall(ctx, http.MethodDelete, path, nil, nil, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Request to remove policy pack failed: %w\", err)\n\t}\n\treturn nil\n}\n\n// RemovePolicyPackByVersion removes a specific version of a `PolicyPack` from\n// the Pulumi organization.\nfunc (pc *Client) RemovePolicyPackByVersion(ctx context.Context, orgName string,\n\tpolicyPackName string, versionTag string,","sourceCodeStart":2187,"sourceCodeEnd":2223,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/backend/httpstate/client/client.go#L2187-L2223","documentation":"Wraps any error from the REST call that disables a policy pack on an organization's policy group (PATCH updatePolicyGroupPath with a disable request).","triggerScenarios":"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.","commonSituations":"Trying to disable a pack already removed from the policy group, insufficient org permissions, or a stale version tag after the pack was updated.","solutions":["Check the wrapped error's HTTP status for the exact cause","Confirm the pack/version is currently enabled on the policy group","Verify org and policy group names","Ensure your token has permission to modify org policy groups"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if !validVersionTag(versionTag) { return errors.New(\"invalid version tag\") }","typeGuard":null,"tryCatchPattern":"if err := client.DisablePolicyPack(ctx, org, pack, version); err != nil {\n\t// tolerate already-disabled packs\n\tif strings.Contains(err.Error(), \"404\") { return nil }\n\treturn fmt.Errorf(\"disable %s@%s: %w\", pack, version, err)\n}","preventionTips":["Check enablement state before disabling","Use admin-scoped tokens","Keep version tags in sync with published versions"],"tags":["network","policy-pack","api-error"],"backgroundTag":"api-request-failed","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}