{"record":{"id":"136f0d5d542c355b","repo":"pulumi/pulumi","slug":"request-to-remove-policy-pack-failed-w","errorCode":null,"errorMessage":"Request to remove policy pack failed: %w","messagePattern":"Request to remove policy pack failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/backend/httpstate/client/client.go","lineNumber":2215,"sourceCode":"\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,\n) error {\n\tpath := deletePolicyPackVersionPath(orgName, policyPackName, versionTag)\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// GetStackPolicyPacks gets the required policy packs currently applicable to the stack.","sourceCodeStart":2197,"sourceCodeEnd":2233,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/pkg/backend/httpstate/client/client.go#L2197-L2233","documentation":"Wraps errors from the DELETE call that removes all versions of a policy pack from the Pulumi organization (RemovePolicyPack).","triggerScenarios":"Calling Client.RemovePolicyPack with a nonexistent org or policy pack name (404), missing delete permissions (403), or network/server failures.","commonSituations":"Deleting a pack that was already removed, typo'd pack name, token scoped to another org, or org admin enforcement preventing deletion.","solutions":["Check the wrapped error's HTTP status","Verify the policy pack still exists in the org","Confirm your token has org admin/delete permissions","Retry on transient network errors"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if orgName == \"\" || policyPackName == \"\" { return errors.New(\"org and policy pack name are required\") }","typeGuard":null,"tryCatchPattern":"if err := client.RemovePolicyPack(ctx, org, pack); err != nil {\n\tif strings.Contains(err.Error(), \"404\") { return nil } // already gone\n\treturn fmt.Errorf(\"removing policy pack %s: %w\", pack, err)\n}","preventionTips":["Make removal idempotent (treat 404 as success)","Confirm delete permissions beforehand","List packs first to verify existence"],"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"}