現在、Apigee X のドキュメントを表示しています。 Apigee Edge のドキュメントを表示する。
InvalidIndex
エラー メッセージ
Apigee UI または API を使用した API プロキシのデプロイに失敗すると、次のエラー メッセージが表示されます。
Error in deployment for environment [environment]
The revision is deployed, but traffic cannot flow.
AssignMessage[policy_name]: index must be greater than zero in [attribute].[index]
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eAPI proxy deployment in Apigee X can fail with an "index must be greater than zero" error when using the HTTPModifier policy.\u003c/p\u003e\n"],["\u003cp\u003eThis error occurs if the \u003ccode\u003e<Copy>\u003c/code\u003e or \u003ccode\u003e<Remove>\u003c/code\u003e elements within the HTTPModifier policy attempt to access indexed flow variables with an index of 0 or a negative number.\u003c/p\u003e\n"],["\u003cp\u003eThe index in the HTTPModifier policy, when dealing with parameters that share the same name, must start at 1, not 0.\u003c/p\u003e\n"],["\u003cp\u003eTo resolve this, verify the index in the failing HTTPModifier policy, ensure that it is a positive number greater than zero, and adjust the index accordingly in the policy definition.\u003c/p\u003e\n"]]],[],null,["# HTTPModifier policy deployment error troubleshooting\n\n*You're viewing **Apigee X** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/troubleshoot/policies/deployment/assign-message-deployment-errors) documentation.*\n| Was this troubleshooting playbook helpful? Please let us know by clicking [Send Feedback]().\n\nInvalidIndex\n------------\n\n### Error message\n\nDeployment of the API proxy through either the Apigee UI or API fails with this error message: \n\n```\nError in deployment for environment [environment]\nThe revision is deployed, but traffic cannot flow.\nAssignMessage[policy_name]: index must be greater than zero in [attribute].[index]\n```\n\n**Example error message** \n\n Error in deployment for environment test.\n The revision is deployed, but traffic cannot flow.\n HTTPModifier[GenerateStudentsRequest]: index must be greater than zero in id.0\n\n### Cause\n\nIf the index specified in the `\u003cCopy\u003e` and/or `\u003cRemove\u003e` elements of the HTTPModifier policy is 0 or a negative number, then deployment of the API Proxy fails.\n\nFor example, if you pass multiple query parameters with the same name, you can access them as indexed flow variables. Let's say you want to pass the IDs of 3 students as query parameters, then you can do it as follows: \n\n https://$EXTERNAL_IP/$PROXY_BASEPATH?school_name=NPS&id=1&id=2&id=3\n\nThen, let's say you attempt to access these query parameters with index numbers 0, 1, and 2 in the HTTPModifier policy as follows: \n\n id.0\n id.1 and\n id.2\n\nIn this case, the deployment of the proxy fails because the index must start with 1. This means, you can access the first query parameter \"id=1\" as \"id.1\". To access the second query parameter \"id=2\", you need to use the index 2 i.e, \"id.2\". Similarly, to access the third query parameter \"id=3\", you can use \"id.3\".\n\nFor more information, see the [AssignMessage policy Copy element documentation](/apigee/docs/api-platform/reference/policies/assign-message-policy#copy).\n\n### Diagnosis\n\n1. Identify the HTTPModifier policy where the error occurred, the name of the attribute, and the invalid index. You can find all these items in the error message. For example, in the following error, the policy name is `GeneratingGeocodingRequest`, the name of the attribute is `id`, and the index is `0`:\n\n HTTPModifier[GenerateStudentsRequest]: index must be greater than zero in id.0\n\n2. Verify that the attribute name and the index used in the failed HTTPModifier policy XML matches the attribute name and the index identified in the error message (step #1 above). For example, the following policy specifies the attribute `id` and index as `0`, which matches what's in the error message:\n\n ```carbon\n \u003cAssignMessage name=\"GenerateStudentsRequest\"\u003e\n \u003cAssignTo createNew=\"true\" type=\"request\"\u003eStudentsInfoRequest\u003c/AssignTo\u003e\n \u003cCopy source=\"request\"\u003e\n \u003cQueryParams\u003e\n \u003cQueryParam name=\"school_name\"/\u003e\n \u003cQueryParam name=\"id.0\"/\u003e\n \u003cQueryParam name=\"id.1\"/\u003e\n \u003cQueryParam name=\"id.2\"/\u003e\n \u003c/QueryParams\u003e\n \u003c/Copy\u003e\n \u003c/AssignMessage\u003e\n ```\n3. If the index specified is 0 or negative number, then that's the cause of the error.\n\n In the example Assign Message policy shown above, you are trying to access the first value of the query parameter \"id\" using the index 0. Hence the deployment of the API Proxy fails with the error: \n\n AssignMessage[GenerateStudentsRequest]: index must be greater than zero in id.0\n\n### Resolution\n\nIn HTTPModifier, when you access multiple headers, query parameters, or other parameters that share the same name, ensure that the index is always greater than zero. For example: \n\n \u003cAssignMessage name=\"GenerateStudentsRequest\"\u003e\n \u003cAssignTo createNew=\"true\" type=\"request\"\u003eStudentsInfoRequest\u003c/AssignTo\u003e\n \u003cCopy source=\"request\"\u003e\n \u003cQueryParams\u003e\n \u003cQueryParam name=\"school_name\"/\u003e\n \u003cQueryParam name=\"id.1\"/\u003e\n \u003cQueryParam name=\"id.2\"/\u003e\n \u003cQueryParam name=\"id.3\"/\u003e\n \u003c/QueryParams\u003e\n \u003c/Copy\u003e\n \u003c/AssignMessage\u003e"]]