{"fault":{"faultstring":"Failed to resolve quota time unit reference [reference] in quota policy {1}","detail":{"errorcode":"policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference"}}}
错误消息示例
{"fault":{"faultstring":"Failed to resolve quota time unit reference apiproduct.developer.quota.timeunity in quota policy {1}","detail":{"errorcode":"policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference"}}}
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-26。"],[[["\u003cp\u003eThe \u003ccode\u003eInvalidMessageWeight\u003c/code\u003e error occurs when a non-integer value is used for the \u003ccode\u003e<MessageWeight>\u003c/code\u003e element in a Quota policy, and the solution is to ensure that the \u003ccode\u003e<MessageWeight>\u003c/code\u003e is set to an integer value.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFailedToResolveQuotaIntervalReference\u003c/code\u003e error occurs when the \u003ccode\u003e<Interval>\u003c/code\u003e element is missing from a Quota policy, requiring it to be added and properly defined.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eFailedToResolveQuotaIntervalTimeUnitReference\u003c/code\u003e error happens when the \u003ccode\u003e<TimeUnit>\u003c/code\u003e element is not defined within a Quota policy, which can be fixed by adding the \u003ccode\u003e<TimeUnit>\u003c/code\u003e element and specifying a valid time unit.\u003c/p\u003e\n"],["\u003cp\u003eThese errors are all related to incorrect or missing elements within Apigee's Quota policies, and their resolutions involve carefully reviewing and modifying the policy configurations.\u003c/p\u003e\n"]]],[],null,["*You're viewing **Apigee** and **Apigee hybrid** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/troubleshoot/policies/runtime/quota-runtime-errors) documentation.*\n| **Note:** Was this troubleshooting playbook helpful? Please let us know by clicking [Send Feedback]().\n\nInvalidMessageWeight\n\nError code \n\n policies.ratelimit.InvalidMessageWeight\n\nError response body \n\n {\n \"fault\": {\n \"faultstring\": \"Invalid message weight value [invalid_value]\",\n \"detail\": {\n \"errorcode\": \"policies.ratelimit.InvalidMessageWeight\"\n }\n }\n }\n\n**Example Error Message** \n\n {\n \"fault\": {\n \"faultstring\": \"Invalid message weight value 1.5\",\n \"detail\": {\n \"errorcode\": \"policies.ratelimit.InvalidMessageWeight\"\n }\n }\n }\n\nCause\n\nThis error occurs if the value of the `\u003cMessageWeight\u003e` element specified through a flow variable is invalid (a non-integer value).\n\nFor example, this error will occur if the value of the flow variable specified for the `\u003cMessageWeight\u003e` element is 1.5 (a non-integer value).\n\nDiagnosis\n\n1. Identify the invalid value used for the `\u003cMessageWeight\u003e` element in the Quota policy. You can find this information in the `faultstring` element of the error response. For example, in the following error, the invalid value used for `\u003cMessageWeight\u003e` element is `1.5`:\n\n \"faultstring\": \"Invalid message weight value 1.5\"\n\n2. Examine all the Quota policies in the specific API Proxy where the failure has occurred. There could be one or more Quota policies in which the `\u003cMessageWeight\u003e` element is specified.\n\n For example, the following policy specifies the `\u003cMessageWeight\u003e`through a flow variable`message_weight`: \n\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cQuota async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"Quota_with_weight\" type=\"calendar\"\u003e\n \u003cDisplayName\u003eQuota_with_weight\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cAllow count=\"3\"/\u003e\n \u003cInterval\u003e1\u003c/Interval\u003e\n \u003cTimeUnit\u003eminute\u003c/TimeUnit\u003e\n \u003cStartTime\u003e2017-7-16 12:00:00\u003c/StartTime\u003e\n \u003cMessageWeight ref=\"message_weight\"/\u003e\n \u003c/Quota\u003e\n\n3. Determine the value of the variable used for `\u003cMessageWeight\u003e` in the identified Quota Policy(ies). The value of the flow variable can be extracted from HTTP headers, query parameters, an XML or JSON request payload, or defined in another policy:\n\n 1. Locate the code within the API Proxy bundle where the variable was defined first.\n 2. Once you figure out the policy in which the variable is defined and populated first, then check how the value for the variable is set.\n 3. If the value of the flow variable matches the value identified in Step #1 above, then that's the cause of the error.\n\n For example, assume that a JavaScript policy used before the Quota Policy sets the variable `message_weight` based on the request type as shown below: \n\n var verb = context.getVariable(\"request.verb\");\n context.setVariable(\"message_weight\", \"1.5\");\n if (verb == 'POST') {\n context.setVariable(\"message_weight\", \"2\");\n }\n\n Notice that the value of the variable `message_weight` is `1.5` which is invalid (a non-integer) value.\n\nResolution\n\nEnsure that the value representing the `MessageWeight` specified by the flow variable is a valid value (integer value).\n\nTo correct the example shown above, you can modify the value of the variable `message_weight` in the JavaScript to be an integer. \n\n var verb = context.getVariable(\"request.verb\");\n context.setVariable(\"message_weight\", \"1\");\n if (verb == 'POST') {\n context.setVariable(\"message_weight\", \"2\");\n }\n\nFailedToResolveQuotaIntervalReference\n\nError code \n\n policies.ratelimit.FailedToResolveQuotaIntervalReference\n\nError response body \n\n {\n \"fault\": {\n \"faultstring\": \"Failed to resolve quota interval reference [reference] in quota policy {1}\",\n \"detail\": {\n \"errorcode\": \"policies.ratelimit.FailedToResolveQuotaIntervalReference\"\n }\n }\n }\n\n**Example Error Message** \n\n {\n \"fault\": {\n \"faultstring\": \"Failed to resolve quota interval reference api.product.developer.quota.interval in quota policy {1}\",\n \"detail\": {\n \"errorcode\": \"policies.ratelimit.FailedToResolveQuotaIntervalReference\"\n }\n }\n }\n\nCause\n\nThis error occurs if the `\u003cInterval\u003e`element is not defined within the Quota policy. This element is mandatory and used to specify the interval of time applicable to the quota. The time interval can be minutes, hours, days, weeks, or months as defined with the `\u003cTimeUnit\u003e` element.\n\nDiagnosis\n\n1. Examine each of the Quota policies in the API Proxy where the failure occurred. If there is any Quota policy where the mandatory element `\u003cInterval\u003e` is not defined, then that's the cause of the error.\n\n For example, the following Quota policy does not have the mandatory element `\u003cInterval\u003e`: \n\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cQuota async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"CheckQuota\" type=\"calendar\"\u003e\n \u003cDisplayName\u003eCheckQuota\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cAllow count=\"3\"/\u003e\n \u003cTimeUnit ref=\"verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit\"\u003ehour\u003c/TimeUnit\u003e\n \u003cStartTime\u003e2017-7-16 12:00:00\u003c/StartTime\u003e\n \u003c/Quota\u003e\n\n Because the mandatory element `\u003cTimeUnit\u003e` is not defined in the above Quota policy, you will receive the error code: \n\n policies.ratelimit.FailedToResolveQuotaIntervalReference\n\nResolution\n\nEnsure that all the Quota policies for a given API proxy have the mandatory element `\u003cInterval\u003e` defined properly.\n\nTo correct the example shown above, you can modify the policy to include the element `\u003cInterval\u003e` as shown below. \n\n```carbon\n\u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n\u003cQuota async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"CheckQuota\" type=\"calendar\"\u003e\n \u003cDisplayName\u003eCheckQuota\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cAllow count=\"3\"/\u003e\n \u003cTimeUnit ref=\"verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit\"\u003ehour\u003c/TimeUnit\u003e\n \u003cInterval ref=\"verifyapikey.verify-api-key.apiproduct.developer.quota.interval\"\u003e1\u003c/Interval\u003e\n \u003cStartTime\u003e2017-7-16 12:00:00\u003c/StartTime\u003e\n\u003c/Quota\u003e\n```\n\nFailedToResolveQuotaIntervalTimeUnitReference\n\nError code \n\n policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference\n\nError response body \n\n {\n \"fault\": {\n \"faultstring\": \"Failed to resolve quota time unit reference [reference] in quota policy {1}\",\n \"detail\": {\n \"errorcode\": \"policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference\"\n }\n }\n }\n\n**Example Error Message** \n\n {\n \"fault\": {\n \"faultstring\": \"Failed to resolve quota time unit reference apiproduct.developer.quota.timeunity in quota policy {1}\",\n \"detail\": {\n \"errorcode\": \"policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference\"\n }\n }\n }\n\nCause\n\nThis error occurs if the `\u003cTimeUnit\u003e`element is not defined within the Quota policy. This element is mandatory and used to specify the unit of time applicable to the quota. The time interval can be in minutes, hours, days, weeks, or months.\n\nDiagnosis\n\n1. Examine each of the Quota policies in the API Proxy where the failure occurred. If there is any Quota policy where the mandatory element `\u003cTimeUnit\u003e` is not defined, then that's the cause of the error.\n\n For example, the following Quota policy does not have the mandatory element `\u003cTimeUnit\u003e`: \n\n \u003cQuota async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"CheckQuota\" type=\"calendar\"\u003e\n \u003cDisplayName\u003eCheckQuota\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cAllow count=\"3\"/\u003e\n \u003cInterval ref=\"verifyapikey.verify-api-key.apiproduct.developer.quota.interval\"\u003e1\u003c/Interval\u003e\n \u003cStartTime\u003e2017-7-16 12:00:00\u003c/StartTime\u003e\n \u003c/Quota\u003e\n\n Because the mandatory element `\u003cTimeUnit\u003e` is not defined in the above Quota policy, you will receive the error code: \n\n policies.ratelimit.FailedToResolveQuotaIntervalTimeUnitReference\n\nResolution\n\nEnsure that all the Quota policies for a given API proxy have the mandatory element `\u003cTimeUnit\u003e` defined.\n\nTo correct the example shown above, you can modify the policy to include the element `\u003cTimeUnit\u003e` as shown below. \n\n```carbon\n\u003cQuota async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"CheckQuota\" type=\"calendar\"\u003e\n \u003cDisplayName\u003eCheckQuota\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cAllow count=\"3\"/\u003e\n \u003cTimeUnit ref=\"verifyapikey.verify-api-key.apiproduct.developer.quota.timeunit\"\u003ehour\u003c/TimeUnit\u003e\n \u003cInterval ref=\"verifyapikey.verify-api-key.apiproduct.developer.quota.interval\"\u003e1\u003c/Interval\u003e\n \u003cStartTime\u003e2017-7-16 12:00:00\u003c/StartTime\u003e\n\u003c/Quota\u003e\n```"]]