Examine all the elements in the failed Regular Expression Protection policy XML. Check if any of the elements has an invalid regular expression. If any of the elements has invalid regular expression, then that's the cause of the error.
For example, the following policy specifies the value of Pattern> of foo){2}, which is considered Invalid Regular Expression:
In the above example, the regular expression specified in the has a missing opening parentheses. Hence it is considered as an invalid regular expression. So the deployment of the API Proxy fails.
Resolution
Ensure that each element in the RegularExpressionProtection policy contains a valid regular expression. You can search for different online or offline regex tools for debugging your regular expressions.
To correct the example Regular Expression Protection policy shown above, add the missing parentheses:
If the prefix or the value used in the element is not part of any of the declared namespaces in the RegularExpressionProtection policy, then the deployment of the API proxy fails.
Identify the name of the RegularExpressionProtection policy where the error occurred and the XPath Expression that was used. You can find both of these items in the error message.
For example, in the following error , the policy name is Regular-Expression-Protection-1 and the XPath Expression is /notapigee:foo/notapigee:bar:
In the failed Regular Expression Protection policy XML, verify that the XPath set in the Expression element matches the XPath identified in the error message (step #1 above).
For example, the following policy specifies the XPath as /notapigee:foo/notapigee:bar which matches what's in the error message:
However, the prefix notapigee is not defined in any of the elements; therefore, the compilation of fails leading to deployment failure.
Resolution
Ensure all the namespaces that are being used in elements under the elements are declared in the RegularExpressionProtection policy. To fix the example above, you could replace notapigee prefix to apigee, which is declared in namespaces:
If the Regular Expression Policy has an expression where the element is defined as nodeset, but the expression cannot be converted to nodeset, then the deployment of the API proxy fails.
Diagnosis
Identify the RegularExpressionProtection policy where the error occurred and the XPath Expression that cannot be converted to nodeset. You can find both of these items in the error message.
For example, in the following error , the policy name is Regular-Expression-Protection-1 and the XPath Expression is count(//apigee:foo):
In the failed Regular Expression Protection policy XML, verify that the XPath set in the element of element matches the XPath identified in the error message (step #1 above).
For example, the following policy specifies the as count(//apigee:foo), which matches what's in the error message:
Examine the value set in the element underneath the element. If the element is nodeset, then that's the cause of the error.
In this example, the XPath expression is count() which doesn't return one or more nodes. So, the deployment of the API Proxy fails.
Resolution
If the element is set to nodeset, ensure that the result of the element set in is one or more nodes. Alternatively, change the element to a more appropriate value based on your use-case.
To fix the example above, you could change the element to a different value that can return nodes:
If the element under element of a Regular Expression Protection policy is set to an invalid JSONPath expression, then the deployment of the API proxy fails.
Diagnosis
Identify the name of the RegularExpressionProtection policy where the error occurred and the invalid JSONPath Expression was used. You can find both of these items in the error message.
For example, in the following error , the policy name is Regular-Expression-Protection-1 and the JSONPath Expression is $.store.book[*.author:
In the failed Regular Expression Protection policy XML, verify that the JSONPath set in the Expression element matches the JSONPath identified in the error message (step #1 above).
For example, the following policy specifies the Expression element under element as $.store.book[*.author which matches what's in the error message:
Examine element under element in the policy. If it doesn't match JSONPath syntax, then this is the cause of the error. In the example above, the closing square bracket is missing, which makes the expression invalid.
Since the JSON Path Expression is invalid, the deployment of the API Proxy fails.
Resolution
Ensure that the value for the element inside of the element in Regular Expression Protection policy is a valid JSONPath expression.
To correct the example shown above, you could add missing closing square bracket to element value:
As indicated in the error message, the RegularExpressionProtection policy must have at least one of these elements included within the policy: , , , , , or .
Diagnosis
Identify the name of the RegularExpressionProtection policy where the error occurred. You can find it in the error message. For example, in the following error , the policy name is Regular-Expression-Protection-1:
Examine the failed Regular Expression Protection policy (identified in step #1 above). If the policy does not have even one of the following elements: , , , , , or , then that's the cause of the error.
For example, the following Regular Expression Protection policy does not have any of the above mentioned elements:
Regular Expression Protection-1falserequest
Since none of the mandatory elements are present in the Extract Variables policy, the deployment of the API proxy fails.
Error Saving Revision 1
RegularExpressionProtection Regular-Expression-Protection-1: No patterns to enforce in XPath.
Example Error Screenshot
Cause
If any of the top level elements (, , , , , or ) doesn't have element defined in the RegularExpressionProtection policy, then the deployment of the API proxy fails.
Diagnosis
Identify the name of the RegularExpressionProtection policy where the error occurred and the child element which does not have the element. You can find both of these items in the error message.
For example, in the following error, the policy name is Regular-Expression-Protection-1 and the child element is XPath:
RegularExpressionProtection Regular-Expression-Protection-1: No patterns to enforce in XPath.
Examine the failing Regular Expression Protection policy and verify if the child element identified in step #1 does not have the element. If element doesn't exist in it, then that's the cause of the error.
For example, the following policy doesn't have element inside of :
Since the element does not have element, the deployment of the API Proxy fails.
Resolution
Ensure that any of the elements , , , , , or has at least one specified. See RegularExpressionProtection policy for information on how to specify the element correctly.
To fix example above we could just add the element to element underneath :
Deployment of the API proxy through either the Apigee UI or API fails with this error message:
Error Saving Revision revision_number
RegularExpressionProtection policy_name: Non-empty prefix prefix_name cannot be mapped to empty uri.
Example Error Message
Error Saving Revision 1
RegularExpressionProtection Regular-Expression-Protection-1: Non-empty prefix apigee cannot be mapped to empty uri.
Example Error Screenshot
Cause
This error occurs if the RegularExpressionProtection policy has a prefix defined in the element under the element, but no URI is defined.
Diagnosis
Identify the RegularExpressionProtection policy where the error occurred and the name of the prefix which is not mapped to URI. You can find both of these items in the error message.
For example, in the following error, the policy name is Regular Expression Protection-1 and the prefix is apigee:
RegularExpressionProtection Regular-Expression-Protection-1: Non-empty prefix apigee cannot be mapped to empty uri.
In the failed Regular Expression Protection policy XML, verify that the name of the prefix set in the element under the element matches the prefix name identified in the error message (step #1 above).
For example, the following policy specifies a prefix named apigee in the element , which matches what's in the error message:
Validate if the element with the specific prefix identified in step #2 has a valid URI. If the URI is missing, then that is the cause of the error.
In the example Regular Expression Protection policy shown above, notice that there's no URI corresponding to the element with the prefix apigee; therefore, you get the error:
Non-empty prefix apigee cannot be mapped to empty uri.
Resolution
Ensure that all the elements defined with a prefix have a corresponding URI in the Extract Variables policy. For example:
Identify the RegularExpressionProtection policy where the error occurred and the name of the prefix. You can find both of these items in the error message.
For example, in the following error, the policy name is Regular Expression Protection-1 and the prefix is apigee:
In the failed Regular Expression Protection policy XML, verify that the name of the prefix set in the element under the element matches the prefix name identified in the error message (step #1 above).
For example, the following policy specifies a prefix named apigee in the element , which matches what's in the error message:
Determine if the element with the specific prefix, identified in step #2 has been defined more than once. If it is defined more than once, then that is the cause of the error.
In the example Regular Expression Protection policy shown above, notice that the element with the prefix apigee has been defined twice; therefore, you get the error:
Identify the failed Regular Expression Protection policy from the error message. For example, in the following error, the policy name is Regular-Expression-Protection-1:
In the failed Regular Expression Protection policy XML, determine if there's an element with child element that has no element defined in it, or element is not set to any value. If so, then that's the cause of the error.
For example, here's a Regular Expression Protection policy that has an element:
Identify the failed Regular Expression Protection policy from the error message. For example, in the following error, the policy name is Regular-Expression-Protection-1:
In the failed Regular Expression Protection policy XML, determine if there's a element with child element that has no element defined in it, or element is not set to any value. If so, then that's the cause of the error.
For example, here's a Regular Expression Protection policy that has a element:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-06-12 UTC."],[[["This document covers common errors encountered when deploying API proxies using the RegularExpressionProtection policy in Apigee and Apigee hybrid."],["Deployment failures can occur due to invalid regular expressions within `\u003cPattern\u003e` elements of the RegularExpressionProtection policy, which can be resolved by correcting the expressions or debugging with regex tools."],["Errors like `XPathCompilationFailed` arise when `\u003cXPath\u003e` elements in the policy use prefixes or values not declared in the policy's `\u003cNamespaces\u003e`, requiring declaration or correction of prefixes."],["The error `CannotBeConvertedToNodeset` happens when an `\u003cXPath\u003e`'s `\u003cType\u003e` is `nodeset` but the `\u003cExpression\u003e` does not return one or more nodes, necessitating either a different `\u003cExpression\u003e` or an alternative `\u003cType\u003e`."],["Various errors, such as `NothingToEnforce`, `NoPatternsToEnforce`, `NONEmptyPrefixMappedToEmptyURI`, `DuplicatePrefix`, `EmptyXPathExpression`, and `EmptyJSONPathExpression`, can be resolved by ensuring the RegularExpressionProtection policy includes the correct mandatory elements like `\u003cURIPath\u003e`, `\u003cQueryParam\u003e`, `\u003cHeader\u003e`, `\u003cFormParam\u003e`, `\u003cXMLPayload\u003e`, or `\u003cJSONPayload\u003e` and ensures that `\u003cPattern\u003e` and `\u003cExpression\u003e` are properly defined with correct syntax and values."]]],[]]