out of scope (not available in the specific flow where the policy is being executed) or
can't be resolved (is not defined)
For example, this error occurs if the Assign Message policy executes in the request flow, but the source attribute in the <Copy> element is set to the response or error variable or any other custom variable that does not exist in the request flow.
Diagnosis
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.
For example, in the following faultstring, the policy name is googleBook and the variable is var:
"faultstring":"AssignMessage[googleBook]: unable to resolve variable var"
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 <Copy> element to a variable named var, which matches what's in the faultstring:
Determine if the variable is defined and available in the flow in which the Assign Message policy is being executed.
If the variable is either:
out of scope (not available in the specific flow where the policy is being executed) or
can't be resolved (is not defined)
then that's the cause for the error.
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:
steps.assignmessage.UnresolvedVariable
Resolution
Ensure that the variable referenced in the policy exists and is available in the specific flow, where the Assign Message policy is being executed.
To correct the example policy shown above, you can modify the source attribute in the <Copy> element to be the request variable or any other custom variable of type message that exists in the request flow.
{"fault":{"faultstring":"AssignMessage[policy_name]: value of variable [variable] is not of type Message","detail":{"errorcode":"steps.assignmessage.VariableOfNonMsgType"}}}
Cause
This error occurs if the source attribute in the <Copy> element is set to a variable which is not of type message.
Message 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.
Diagnosis
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:
"faultstring":"AssignMessage[GenerateGeocodingRequest]: value of variable PostalCode is not of type Message"
In the failed Assign Message Policy XML, verify that the name of the variable set in the <Copy> 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:
Determine if this variable is of type message or not:
Locate the code within the API Proxy bundle, where the variable was defined first.
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:
Check the value of the type attribute (if present).
If the type attribute is not present, then the variable is considered to be a string.
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.
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 <AssignVariable> element. This value is a string, because there is no type attribute present in the variable assignment.
Now, recall that the PostalCode variable is used in the <Copy> element of the Assign Message policy:
Because PostalCode is not of type message (it's a string in this example), you receive the error code:
steps.assignmessage.VariableOfNonMsgType
Resolution
Ensure that the source attribute in the <Copy> element in the failed Assign Message policy is set to a message type flow variable that exists.
To correct the policy, you can modify the source attribute in the <Copy> 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.
[[["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-08-28 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"]]