{
"fault":{
"faultstring":"Failed to set variable variable_name in KeyValueMapStepDefinition policy_name",
"detail":{
"errorcode":"steps.keyvaluemapoperations.SetVariableFailed"
}
}
}
エラー メッセージの例
{"fault":{"faultstring":"Failed to set variable myvar in KeyValueMapStepDefinition EncryptedKVM","detail":{"errorcode":"steps.keyvaluemapoperations.SetVariableFailed"}}}
[[["わかりやすい","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-08-18 UTC。"],[[["\u003cp\u003eThis document addresses troubleshooting for two specific errors related to Apigee's Key Value Map Operations policy: \u003ccode\u003eUnsupportedOperationException\u003c/code\u003e and \u003ccode\u003eSetVariableFailed\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eUnsupportedOperationException\u003c/code\u003e error occurs when the \u003ccode\u003emapIdentifier\u003c/code\u003e attribute in a Key Value Map Operations policy is set to an empty string, which can be fixed by setting it to a valid key value map.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eSetVariableFailed\u003c/code\u003e error happens when retrieving a value from an encrypted key value map and assigning it to a variable without the \u003ccode\u003eprivate.\u003c/code\u003e prefix, and resolving this involves adding the prefix to the variable name.\u003c/p\u003e\n"],["\u003cp\u003eTo identify if the \u003ccode\u003eSetVariableFailed\u003c/code\u003e error is caused by retrieving from an encrypted key value map you must look for a masked value in the UI using asterisks.\u003c/p\u003e\n"],["\u003cp\u003eThe document provides specific XML examples to illustrate both the error-causing configurations and the correct configurations to fix each issue.\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/key-value-map-runtime-errors) documentation.*\n| **Note:** Was this troubleshooting playbook helpful? Please let us know by clicking [Send Feedback]().\n\nUnsupportedOperationException\n\nError code \n\n java.lang.UnsupportedOperationException\n\nError response body \n\n {\n \"fault\":{\n \"faultstring\":\"java.lang.UnsupportedOperationException\",\n \"detail\":{\n \"errorcode\":\"Internal Server Error\"\n }\n }\n }\n\nCause\n\nThis error occurs if the `mapIdentifier` attribute is set to an empty string in the Key Value Map Operations policy.\n\nDiagnosis\n\n1. Examine all the Key Value Map Operations policies in the specific API Proxy where the failure has occurred. If there is any Key Value Map Operations policy in which the `mapIdentifier` attribute is set as an empty string, then that's the cause of the error.\n\n For example, the following Key Value Map Operations policy has an empty `mapIdentifier`: \n\n \u003cKeyValueMapOperations async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"StoreKvm\" mapIdentifier=\"\"\u003e\n \u003cDisplayName\u003eStoreKvm\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cExclusiveCache\u003efalse\u003c/ExclusiveCache\u003e\n \u003cExpiryTimeInSecs\u003e300\u003c/ExpiryTimeInSecs\u003e\n \u003cPut override=\"true\"\u003e\n \u003cKey\u003e\n \u003cParameter ref=\"request.queryparam.key\"/\u003e\n \u003c/Key\u003e\n \u003cValue ref=\"request.queryparam.value\"/\u003e\n \u003c/Put\u003e\n \u003cScope\u003eenvironment\u003c/Scope\u003e\n \u003c/KeyValueMapOperations\u003e\n\nResolution\n\nEnsure the attribute `mapIdentifier` is set to a valid key value map in the Key Value Map Operations policy.\n\nTo correct the example policy shown above, you can specify the `mapIdentifier` to an existing key value map `UserLocationMap`. \n\n \u003cKeyValueMapOperations async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"StoreKvm\" mapIdentifier=\"UserLocationMap\"\u003e\n \u003cDisplayName\u003eStoreKvm\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cExclusiveCache\u003efalse\u003c/ExclusiveCache\u003e\n \u003cExpiryTimeInSecs\u003e300\u003c/ExpiryTimeInSecs\u003e\n \u003cPut override=\"true\"\u003e\n \u003cKey\u003e\n \u003cParameter ref=\"request.queryparam.key\"/\u003e\n \u003c/Key\u003e\n \u003cValue ref=\"request.queryparam.value\"/\u003e\n \u003c/Put\u003e\n \u003cScope\u003eenvironment\u003c/Scope\u003e\n \u003c/KeyValueMapOperations\u003e\n\nSetVariableFailed\n\nError code \n\n steps.keyvaluemapoperations.SetVariableFailed\n\nError response body \n\n```\n{\n \"fault\":{\n \"faultstring\":\"Failed to set variable variable_name in KeyValueMapStepDefinition policy_name\",\n \"detail\":{\n \"errorcode\":\"steps.keyvaluemapoperations.SetVariableFailed\"\n }\n }\n}\n```\n\nExample Error Message \n\n {\n \"fault\":{\n \"faultstring\":\"Failed to set variable myvar in KeyValueMapStepDefinition EncryptedKVM\",\n \"detail\":{\n \"errorcode\":\"steps.keyvaluemapoperations.SetVariableFailed\"\n }\n }\n }\n\nCause\n\nThis error occurs if you try to retrieve a value from an encrypted key value map\nand set the value to a variable whose name does not have the prefix `private.`. The\nprefix, which is required for basic security purposes during debugging, hides the\nencrypted values from API proxy Trace and debug sessions.\n\nDiagnosis\n\n1.\nIdentify the Key Value Map Operations policy where the error occurred and the name of the variable to which the value cannot be set. You can find both of these items in the `faultstring` element of the error response. For example, in the following `faultstring`, the policy name is `EncryptedKVM` and the variable is `myvar`: \n\n \"faultstring\":\"Failed to set variable myvar in KeyValueMapStepDefinition EncryptedKVM\"\n\n1.\nIn the failed Key Value Map Operations policy XML, verify that the name of the variable specified in the **`assignTo`** attribute of the `\u003cGet\u003e` element matches the variable name identified in the fault string (step #1 above). For example, the following Key Value Map Operations policy specifies a variable named `myvar` in the `\u003cGet\u003e` element, which matches what's in the `faultstring`: \n\n \u003cKeyValueMapOperations async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"Key-Value-Map-Operations-1\" mapIdentifier=\"testEncrypted\"\u003e\n \u003cDisplayName\u003eKeyValueMapOperations-1\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cExclusiveCache\u003efalse\u003c/ExclusiveCache\u003e\n \u003cExpiryTimeInSecs\u003e300\u003c/ExpiryTimeInSecs\u003e\n \u003cGet assignTo=\"myvar\" index=\"1\"\u003e\n \u003cKey\u003e\n \u003cParameter\u003efoo\u003c/Parameter\u003e\n \u003c/Key\u003e\n \u003c/Get\u003e\n \u003cScope\u003eenvironment\u003c/Scope\u003e\n \u003c/KeyValueMapOperations\u003e\n\n1. Check if the key value map specified in the `mapIdentifier` attribute is an encrypted KVM.\n\n To check if a KVM is encrypted in the Apigee UI:\n 1. In the Apigee UI, click **Admin** in the left navigation menu.\n 2. Click **Environments**.\n 3. Click **Key Value Maps**.\n 4. Find the Key Value Map you want to use.\n 5. Click the arrow to the left of the name to expand the list of values.\n 6. Encrypted Key Value Maps display values masked with asterisks in the UI (\\*\\*\\*\\*\\*) as shown in [About encrypted KVMs](/apigee/docs/api-platform/cache/key-value-maps#aboutencrypted).\n2. If the key value map is an encrypted KVM and the variable name used in the\n `assignTo` attribute of the `\u003cGet\u003e` element does not have the prefix `private`.\n Then that's the cause for the error.\n\n In the example Key Value Map Operations policy shown above, the key value map `testEncrypted` is encrypted and the variable name `myvar` does not have the prefix `private`. Hence you receive the error code: \n\n steps.keyvaluemapoperations.SetVariableFailed\n\nResolution\n\nEnsure that the variable name has the prefix `private.` in the `assignTo` attribute\nof the `\u003cGet\u003e` element in Key Value Map Operations policy if the key value map\nused is encrypted.\n\nTo correct the example Key Value Map Operations policy shown above, you can modify\nthe value of the attribute `assignTo` to `private.myvar`: \n\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?\u003e\n \u003cKeyValueMapOperations async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"Key-Value-Map-Operations-1\" mapIdentifier=\"testEncrypted\"\u003e\n \u003cDisplayName\u003eKeyValueMapOperations-1\u003c/DisplayName\u003e\n \u003cProperties/\u003e\n \u003cExclusiveCache\u003efalse\u003c/ExclusiveCache\u003e\n \u003cExpiryTimeInSecs\u003e300\u003c/ExpiryTimeInSecs\u003e\n \u003cGet assignTo=\"private.myvar\" index=\"1\"\u003e\n \u003cKey\u003e\n \u003cParameter\u003efoo\u003c/Parameter\u003e\n \u003c/Key\u003e\n \u003c/Get\u003e\n \u003cScope\u003eenvironment\u003c/Scope\u003e\n \u003c/KeyValueMapOperations\u003e"]]