Solución de problemas relacionados con el error de tiempo de ejecución de Message
Organiza tus páginas con colecciones
Guarda y categoriza el contenido según tus preferencias.
Estás viendo la documentación de Apigee y Apigee Hybrid.
Consulta la documentación de Apigee Edge.
UnresolvedVariable
Código de error
steps.assignmessage.UnresolvedVariable
Cuerpo de la respuesta del error
{"fault":{"faultstring":"AssignMessage[policy_name]: unable to resolve variable [variable_name]","detail":{"errorcode":"steps.assignmessage.UnresolvedVariable"}}}
Causa
Este error se produce si una variable especificada en la política AssignMessage es una de las siguientes:
fuera de alcance (no disponible en el flujo específico en el que se ejecuta la política)
no se puede resolver (no está definido)
Por ejemplo, este error ocurre si la política de asignación de mensajes se ejecuta en el flujo de solicitudes, pero el atributo source del elemento <Copy> se configura como la variable response o error, o cualquier otra variable personalizada que no existe en el flujo de solicitudes.
Diagnóstico
Identifica la política de asignación de mensajes en la que se generó el error y el nombre de la variable que no está disponible. Puedes encontrar ambos elementos en el elemento faultstring de la respuesta de error.
Por ejemplo, en el siguiente valor faultstring, el nombre de la política es googleBook y la variable es var:
"faultstring":"AssignMessage[googleBook]: unable to resolve variable var"
En el archivo XML de la política de asignación de mensajes, verifica que el nombre de la variable usada coincida con el nombre de variable identificado en la string con errores (paso 1 anterior). Por ejemplo, en la siguiente política, se establece el atributo de origen en el elemento <Copy> en una variable llamada var, que coincide con lo que hay en la faultstring:
Determina si la variable está definida y disponible en el flujo en el que se ejecuta la política de protección contra el aumento de tráfico.
Verifica si la variable tiene una de las siguientes características:
fuera de alcance (no disponible en el flujo específico en el que se ejecuta la política) o
no se puede resolver (no está definido)
entonces esa es la causa del error.
A modo de ejemplo, supongamos que la política de asignación de mensajes que se muestra arriba se ejecuta en el flujo de solicitudes. Verifica si la variable var se define en cualquiera de las políticas que se ejecutan antes de la política de asignación de mensajes en el flujo de solicitudes. Si no se definió la variable, recibirá el código de error:
steps.assignmessage.UnresolvedVariable
Solución
Asegúrate de que la variable a la que se hace referencia en la política exista y esté disponible en el flujo específico, en el que se ejecutará la política de asignación de mensajes.
Si quieres corregir la política de ejemplo que se muestra arriba, puedes modificar el atributo de origen en el elemento <Copy> para que sea la variable de solicitud o cualquier otra variable personalizada de tipo de mensaje que exista en el flujo de la solicitud.
{"fault":{"faultstring":"AssignMessage[policy_name]: value of variable [variable] is not of type Message","detail":{"errorcode":"steps.assignmessage.VariableOfNonMsgType"}}}
Causa
Este error ocurre si el atributo source del elemento <Copy> se configuró como una variable que no es del tipo message.
Las variables del tipo de mensaje representan respuestas y solicitudes HTTP completas. Las variables de flujo integradas request, response y message son de tipo de mensaje. Para obtener más información acerca de las variables de mensaje, consulta la Referencia de lasvariables.
Diagnóstico
Identifica la política de asignación de mensajes en la que se generó el error y el nombre de la variable cuyo tipo es incorrecto. Puedes encontrar ambos elementos en el elemento faultstring de la respuesta de error. Por ejemplo, en el siguiente valor faultstring, el nombre de la política es GenerateGeocodingRequest y la variable es PostalCode:
"faultstring":"AssignMessage[GenerateGeocodingRequest]: value of variable PostalCode is not of type Message"
En el archivo XML de la política de asignación mensajes con errores, verifica que el nombre de la variable establecida en el elemento <Copy> coincida con el nombre de la variable identificado en la string con errores (paso 1 anterior). Por ejemplo, en la siguiente política, se establece un atributo de origen en una variable llamada PostalCode, que coincide con lo que hay en la faultstring:
Determina si esta variable es de tipo de mensaje o no:
Localiza el código dentro del paquete del proxy de API, en el que la variable se definió primero.
Una vez que determines la política en la que se define y propaga la variable primero, debes determinar el tipo de esa variable de la siguiente manera:
Comprueba el valor del atributo del tipo (si está presente).
Si el atributo de tipo no está presente, la variable se considera una string.
Si el tipo de la variable no es de mensaje (como una string), esta es la causa del error. Puedes obtener información sobre las variables comunes y sus tipos en la referencia de variables.
Por ejemplo, observa la variable PostalCode en la XML anterior. Se le asigna el valor de la variable de flujo request.queryparam.postalcode en el elemento <AssignVariable>. Este valor es una string, porque no hay un tipo de atributo presente en la asignación de la variable.
Ahora, recuerda que la variable PostalCode se usa en el elemento <Copy> de la política de asignación de mensajes:
Debido a que PostalCode no es de tipo de mensaje (en este ejemplo, es una string), recibes el código de error:
steps.assignmessage.VariableOfNonMsgType
Solución
Asegúrate de que el atributo source del elemento <Copy> de la política de asignación de mensajes con errores tenga una variable de flujo de tipo mensaje que existe.
Para corregir la política, puedes modificar el atributo source en el elemento <Copy> a fin de especificar una variable que sea de tipo de mensaje. Por ejemplo, si suponemos que la política de asignación de mensajes se ejecutará en el flujo de solicitudes, puedes usar la variable de tipo de mensaje request o cualquier otra variable personalizada de tipo de mensaje.
[[["Fácil de comprender","easyToUnderstand","thumb-up"],["Resolvió mi problema","solvedMyProblem","thumb-up"],["Otro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Información o código de muestra incorrectos","incorrectInformationOrSampleCode","thumb-down"],["Faltan la información o los ejemplos que necesito","missingTheInformationSamplesINeed","thumb-down"],["Problema de traducción","translationIssue","thumb-down"],["Otro","otherDown","thumb-down"]],["Última actualización: 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"]]