di luar cakupan (tidak tersedia dalam alur tertentu tempat kebijakan dijalankan) atau
tidak dapat diselesaikan (tidak ditentukan)
Misalnya, error ini terjadi jika kebijakan Tetapkan Pesan dieksekusi dalam alur permintaan, tetapi atribut source di elemen <Copy> ditetapkan ke variabel response atau error atau variabel kustom lainnya yang tidak ada dalam alur permintaan.
Diagnosis
Identifikasi Kebijakan Tetapkan Pesan tempat error terjadi dan nama variabel yang tidak tersedia. Anda dapat menemukan kedua item ini di elemen faultstring respons error.
Misalnya, dalam faultstring berikut, nama kebijakan adalah googleBook dan variabelnya adalah var:
"faultstring":"AssignMessage[googleBook]: unable to resolve variable var"
Dalam XML Kebijakan Pesan Penetapan yang gagal, pastikan nama variabel yang digunakan cocok dengan nama variabel yang diidentifikasi dalam string error (langkah #1 di atas). Misalnya, kebijakan berikut menetapkan atribut sumber di elemen <Copy> ke variabel bernama var, yang cocok dengan yang ada di faultstring:
Tentukan apakah variabel ditentukan dan tersedia dalam alur tempat kebijakan Tetapkan Pesan dijalankan.
Jika variabel adalah:
di luar cakupan (tidak tersedia dalam alur tertentu tempat kebijakan dijalankan) atau
tidak dapat diselesaikan (tidak ditentukan)
maka itu adalah penyebab error.
Sebagai contoh, misalkan kebijakan Tetapkan Pesan yang ditampilkan di atas dijalankan dalam alur permintaan. Periksa apakah variabel var ditentukan dalam kebijakan apa pun yang dieksekusi sebelum kebijakan Tetapkan Pesan dalam alur permintaan. Jika variabel belum ditentukan, Anda akan menerima kode error:
steps.assignmessage.UnresolvedVariable
Resolusi
Pastikan variabel yang dirujuk dalam kebijakan ada dan tersedia dalam alur tertentu, tempat kebijakan Tetapkan Pesan sedang dijalankan.
Untuk memperbaiki contoh kebijakan yang ditampilkan di atas, Anda dapat mengubah atribut sumber di elemen <Copy> menjadi variabel permintaan atau variabel kustom jenis pesan lainnya yang ada dalam alur permintaan.
{"fault":{"faultstring":"AssignMessage[policy_name]: value of variable [variable] is not of type Message","detail":{"errorcode":"steps.assignmessage.VariableOfNonMsgType"}}}
Penyebab
Error ini terjadi jika atribut source di elemen <Copy> ditetapkan ke variabel yang bukan dari jenis message.
Variabel jenis pesan mewakili seluruh permintaan dan respons HTTP. Variabel alur bawaan request, response, dan message adalah jenis pesan. Untuk mempelajari variabel pesan lebih lanjut, lihat Referensi variabel.
Diagnosis
Identifikasi Kebijakan Tetapkan Pesan tempat error terjadi dan nama variabel yang jenisnya salah. Anda dapat menemukan kedua item ini di elemen faultstring respons error. Misalnya, dalam faultstring berikut, nama kebijakan adalah GenerateGeocodingRequest dan variabelnya adalah PostalCode:
"faultstring":"AssignMessage[GenerateGeocodingRequest]: value of variable PostalCode is not of type Message"
Dalam XML Kebijakan Pesan Penetapan yang gagal, pastikan nama variabel yang ditetapkan di elemen <Copy> cocok dengan nama variabel yang diidentifikasi dalam string error (langkah #1 di atas). Misalnya, kebijakan berikut menetapkan atribut sumber ke variabel bernama PostalCode, yang cocok dengan yang ada di faultstring:
Tentukan apakah variabel ini berjenis pesan atau bukan:
Temukan kode dalam paket API Proxy, tempat variabel ditentukan terlebih dahulu.
Setelah mengetahui kebijakan tempat variabel ditentukan dan diisi terlebih dahulu, Anda perlu menentukan jenis variabel tersebut sebagai berikut:
Periksa nilai atribut type (jika ada).
Jika atribut type tidak ada, variabel akan dianggap sebagai string.
Jika jenis variabelnya bukan pesan (seperti string), hal itu adalah penyebab error. Anda dapat mempelajari variabel umum dan jenisnya di Referensi variabel.
Misalnya, lihat variabel PostalCode dalam XML di atas. Nilai variabel alur request.queryparam.postalcode ditetapkan di elemen <AssignVariable>. Nilai ini adalah string, karena tidak ada atribut jenis yang ada dalam penetapan variabel.
Sekarang, ingat bahwa variabel PostalCode digunakan dalam elemen <Copy> kebijakan Tetapkan Pesan:
Karena PostalCode bukan dari jenis pesan (string dalam contoh ini), Anda akan menerima kode error:
steps.assignmessage.VariableOfNonMsgType
Resolusi
Pastikan atribut source di elemen <Copy> dalam kebijakan Tetapkan Pesan yang gagal ditetapkan ke variabel alur jenis pesan yang ada.
Untuk memperbaiki kebijakan, Anda dapat mengubah atribut source di elemen <Copy> untuk menentukan variabel yang berjenis pesan. Misalnya, jika kebijakan Tetapkan Pesan seharusnya dijalankan dalam alur permintaan, Anda dapat menggunakan variabel jenis pesan request atau variabel kustom jenis pesan lainnya.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-04 UTC."],[[["\u003cp\u003eThis documentation focuses on troubleshooting two specific errors within the Apigee Assign Message policy: \u003ccode\u003esteps.assignmessage.UnresolvedVariable\u003c/code\u003e and \u003ccode\u003esteps.assignmessage.VariableOfNonMsgType\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003esteps.assignmessage.UnresolvedVariable\u003c/code\u003e error occurs when a variable referenced in the Assign Message policy is not defined or is out of scope in the current flow, requiring a review of variable definition and flow context.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003esteps.assignmessage.VariableOfNonMsgType\u003c/code\u003e error arises when the \u003ccode\u003esource\u003c/code\u003e attribute in the \u003ccode\u003e<Copy>\u003c/code\u003e element refers to a variable that is not of the message type, which requires ensuring it is set to a message-type variable such as \u003ccode\u003erequest\u003c/code\u003e, \u003ccode\u003eresponse\u003c/code\u003e, or any other custom variable of type message.\u003c/p\u003e\n"],["\u003cp\u003eTo resolve the \u003ccode\u003eUnresolvedVariable\u003c/code\u003e error, ensure the variable exists and is within the scope of the policy's execution flow; to resolve \u003ccode\u003eVariableOfNonMsgType\u003c/code\u003e, use a message-type variable for the source attribute.\u003c/p\u003e\n"],["\u003cp\u003eThe main error context in question can be resolved by checking the policy, the variables, the flow, and adjusting the policy with either a defined variable or a message type variable.\u003c/p\u003e\n"]]],[],null,["# Assign Message runtime error troubleshooting\n\n*You're viewing **Apigee** and **Apigee hybrid** documentation.\nView [Apigee Edge](https://docs.apigee.com/api-platform/troubleshoot/policies/runtime/assign-message-runtime-errors) documentation.*\n| **Note:** Was this troubleshooting playbook helpful? Please let us know by clicking [Send Feedback]().\n\nUnresolvedVariable\n------------------\n\n### Error code\n\n steps.assignmessage.UnresolvedVariable\n\n### Error response body\n\n```transact-sql\n{\n \"fault\": {\n \"faultstring\": \"AssignMessage[\u003cvar translate=\"no\"\u003epolicy_name\u003c/var\u003e]: unable to resolve variable [\u003cvar translate=\"no\"\u003evariable_name\u003c/var\u003e]\",\n \"detail\": {\n \"errorcode\": \"steps.assignmessage.UnresolvedVariable\"\n }\n }\n}\n```\n\n### Cause\n\nThis error occurs if a variable specified in the [Assign Message policy](/apigee/docs/api-platform/reference/policies/assign-message-policy) is either:\n\n- out of scope (not available in the specific flow where the policy is being executed) or\n- can't be resolved (is not defined)\n\nFor example, this error occurs if the Assign Message policy executes in the request flow, but the `source` attribute in the `\u003cCopy\u003e` element is set to the `response` or `error` variable or any other custom variable that does not exist in the request flow.\n\n### Diagnosis\n\n1. Identify the Assign Message Policy where the error occurred and the name of the variable that is not available. You can find both of these items in the `faultstring` element of the error response.\n\n For example, in the following `faultstring`, the policy name is `googleBook` and the variable is `var`: \n\n \"faultstring\": \"AssignMessage[googleBook]: unable to resolve variable var\"\n\n2. In the failed Assign Message Policy XML, verify that the name of the variable used matches the variable name identified in the fault string (step #1 above). For example, the following policy sets the source attribute in the `\u003cCopy\u003e` element to a variable named `var`, which matches what's in the `faultstring`:\n\n \u003cAssignMessage async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"Assign-Message-1\"\u003e\n \u003cDisplayName\u003egoogleBook\u003c/DisplayName\u003e\n \u003cProperties /\u003e\n \u003cCopy source=\"var\"\u003e\n \u003cHeaders\u003e\n \u003cHeader name=\"user-agent\" /\u003e\n \u003c/Headers\u003e\n \u003c/Copy\u003e\n \u003cIgnoreUnresolvedVariables\u003efalse\u003c/IgnoreUnresolvedVariables\u003e\n \u003cAssignTo createNew=\"true\" transport=\"http\" type=\"request\"\u003egoogleBookReq\u003c/AssignTo\u003e\n \u003c/AssignMessage\u003e\n\n3. Determine if the variable is defined and available in the flow in which the Assign Message policy is being executed.\n\n4. If the variable is either:\n\n 1. out of scope (not available in the specific flow where the policy is being executed) or\n 2. can't be resolved (is not defined)\n\n then that's the cause for the error.\n\n As an example, let's say the Assign Message policy shown above executes in the request flow. Check if the variable `var` is defined in any of the policies that are executed before the Assign Message policy in the request flow. If the variable has not been defined, then you will receive the error code: \n\n steps.assignmessage.UnresolvedVariable\n\n### Resolution\n\nEnsure that the variable referenced in the policy exists and is available in the specific flow, where the Assign Message policy is being executed.\n\nTo correct the example policy shown above, you can modify the source attribute in the `\u003cCopy\u003e` element to be the request variable or any other custom variable of type message that exists in the request flow. \n\n \u003cAssignMessage async=\"false\" continueOnError=\"false\" enabled=\"true\" name=\"Assign-Message-1\"\u003e\n \u003cDisplayName\u003egoogleBook\u003c/DisplayName\u003e\n \u003cProperties /\u003e\n \u003cCopy source=\"request\"\u003e\n \u003cHeaders\u003e\n \u003cHeader name=\"user-agent\" /\u003e\n \u003c/Headers\u003e\n \u003c/Copy\u003e\n \u003cIgnoreUnresolvedVariables\u003efalse\u003c/IgnoreUnresolvedVariables\u003e\n \u003cAssignTo createNew=\"true\" transport=\"http\" type=\"request\"\u003egoogleBookReq\u003c/AssignTo\u003e\n \u003c/AssignMessage\u003e\n\nVariableOfNonMsgType\n--------------------\n\n### Error code\n\n steps.assignmessage.VariableOfNonMsgType\n\n### Error response body\n\n```transact-sql\n{\n \"fault\": {\n \"faultstring\": \"AssignMessage[\u003cvar translate=\"no\"\u003epolicy_name\u003c/var\u003e]: value of variable [\u003cvar translate=\"no\"\u003evariable\u003c/var\u003e] is not of type Message\",\n \"detail\": {\n \"errorcode\": \"steps.assignmessage.VariableOfNonMsgType\"\n }\n }\n}\n```\n\n### Cause\n\nThis error occurs if the `source` attribute in the `\u003cCopy\u003e` element is set to a variable which is not of type [message](/apigee/docs/api-platform/reference/variables-reference#messagevariables).\n\nMessage type variables represent entire HTTP requests and responses. The built-in flow variables `request`, `response`, and `message` are of type message. To learn more about message variables, see the [Variables reference](/apigee/docs/api-platform/reference/variables-reference#messagevariables).\n\n### Diagnosis\n\n1. Identify the Assign Message Policy where the error occurred and the name of the variable whose type is incorrect. 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 `GenerateGeocodingRequest` and the variable is `PostalCode`:\n\n \"faultstring\": \"AssignMessage[GenerateGeocodingRequest]: value of variable PostalCode is not of type Message\"\n\n2. In the failed Assign Message Policy XML, verify that the name of the variable set in the `\u003cCopy\u003e` element matches the variable name identified in the fault string (step #1 above). For example, the following policy sets a source attribute to a variable named `PostalCode`, which matches what's in the `faultstring`:\n\n \u003cAssignMessage name=\"GenerateGeocodingRequest\"\u003e\n \u003cAssignTo createNew=\"true\" type=\"request\"\u003eGeocodingRequest\u003c/AssignTo\u003e\n \u003cAssignVariable\u003e\n \u003cName\u003ePostalCode\u003c/Name\u003e\n \u003cRef\u003erequest.queryparam.postalcode\u003c/Ref\u003e\n \u003c/AssignVariable\u003e\n \u003cAssignVariable\u003e\n \u003cName\u003eCountry\u003c/Name\u003e\n \u003cRef\u003erequest.queryparam.country\u003c/Ref\u003e\n \u003c/AssignVariable\u003e\n \u003cCopy source=\"PostalCode\"\u003e\n \u003cQueryParams\u003e\n \u003cQueryParam name=\"q\" /\u003e\n \u003c/QueryParams\u003e\n \u003c/Copy\u003e\n \u003c/AssignMessage\u003e\n\n3. Determine if this variable is of type message or not:\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, you need to determine the type of that variable as follows:\n 1. Check the value of the type attribute (if present).\n 2. If the type attribute is not present, then the variable is considered to be a string.\n 3. If the variable's type is non-message (such as a string), then that's the cause of the error. You can learn about common variables and their types in the [Variables reference](/apigee/docs/api-platform/reference/variables-reference).\n\n For example, look at the PostalCode variable in the above XML. It is assigned the value of the flow variable `request.queryparam.postalcode` in the `\u003cAssignVariable\u003e` element. This value is a string, because there is no type attribute present in the variable assignment.\n\n Now, recall that the PostalCode variable is used in the `\u003cCopy\u003e` element of the Assign Message policy: \n\n \u003cCopy source=\"PostalCode\"\u003e\n \u003cQueryParams\u003e\n \u003cQueryParam name=\"PostalCode\" /\u003e\n \u003c/QueryParams\u003e\n \u003c/Copy\u003e\n\n Because PostalCode is not of type message (it's a string in this example), you receive the error code: \n\n steps.assignmessage.VariableOfNonMsgType\n\n### Resolution\n\nEnsure that the `source` attribute in the `\u003cCopy\u003e` element in the failed Assign Message policy is set to a [message](/apigee/docs/api-platform/reference/variables-reference#messagevariables) type flow variable that exists.\n\nTo correct the policy, you can modify the `source` attribute in the `\u003cCopy\u003e` element to specify a variable that is of type message. For example, if the Assign Message policy is supposed to execute in the request flow, then you could use the message type variable `request` or any other custom variable of type message. \n\n \u003cAssignMessage name=\"GenerateGeocodingRequest\"\u003e\n \u003cAssignTo createNew=\"true\" type=\"request\"\u003eGeocodingRequest\u003c/AssignTo\u003e\n \u003cAssignVariable\u003e\n \u003cName\u003ePostalCode\u003c/Name\u003e\n \u003cRef\u003erequest.queryparam.postalcode\u003c/Ref\u003e\n \u003c/AssignVariable\u003e\n \u003cAssignVariable\u003e\n \u003cName\u003eCountry\u003c/Name\u003e\n \u003cRef\u003erequest.queryparam.country\u003c/Ref\u003e\n \u003c/AssignVariable\u003e\n \u003cCopy source=\"request\"\u003e\n \u003cQueryParams\u003e\n \u003cQueryParam name=\"PostalCode\" /\u003e\n \u003c/QueryParams\u003e\n \u003c/Copy\u003e\n \u003c/AssignMessage\u003e"]]