fuori ambito (non disponibile nel flusso specifico in cui viene eseguito il criterio) o
non può essere risolto (non è definito)
Ad esempio, questo errore si verifica se il criterio Assegna messaggio viene eseguito nel flusso di richieste, ma l'attributo source nell'elemento <Copy> è impostato sulla variabile response o error o su qualsiasi altra variabile personalizzata che non esiste nel flusso di richieste.
Diagnosi
Identifica il criterio Assegna messaggio in cui si è verificato l'errore e il nome della variabile non disponibile. Puoi trovare entrambi questi elementi nell'elemento faultstring della risposta all'errore.
Ad esempio, nel seguente faultstring, il nome del criterio è googleBook e la variabile è var:
"faultstring":"AssignMessage[googleBook]: unable to resolve variable var"
Nel file XML del criterio di assegnazione dei messaggi non riuscito, verifica che il nome della variabile utilizzata corrisponda al nome della variabile identificato nella stringa di errore (passaggio 1 sopra). Ad esempio, la seguente norma imposta l'attributo source nell'elemento <Copy> su una variabile denominata var, che corrisponde a quanto indicato in faultstring:
Determina se la variabile è definita e disponibile nel flusso in cui viene eseguito il criterio Assegna messaggio.
Se la variabile è:
fuori ambito (non disponibile nel flusso specifico in cui viene eseguito il criterio) o
non può essere risolto (non è definito)
allora è la causa dell'errore.
Ad esempio, supponiamo che il criterio Assegna messaggio mostrato sopra venga eseguito nel flusso di richiesta. Verifica se la variabile var è definita in uno dei criteri eseguiti prima del criterio Assegna messaggio nel flusso di richiesta. Se la variabile non è stata definita, riceverai il codice di errore:
steps.assignmessage.UnresolvedVariable
Risoluzione
Assicurati che la variabile a cui si fa riferimento nel criterio esista ed è disponibile nel flusso specifico in cui viene eseguito il criterio Assegna messaggio.
Per correggere il criterio di esempio mostrato sopra, puoi modificare l'attributo source nell'elemento <Copy> in modo che corrisponda alla variabile request o a qualsiasi altra variabile personalizzata di tipo message esistente nel flusso di richiesta.
{"fault":{"faultstring":"AssignMessage[policy_name]: value of variable [variable] is not of type Message","detail":{"errorcode":"steps.assignmessage.VariableOfNonMsgType"}}}
Causa
Questo errore si verifica se l'attributo source nell'elemento <Copy> è impostato su una variabile non di tipo message.
Le variabili di tipo di messaggio rappresentano intere richieste e risposte HTTP. Le variabili di flusso integrate request, response e message sono di tipo message. Per scoprire di più sulle variabili dei messaggi, consulta la sezione Riferimento alle variabili.
Diagnosi
Identifica il criterio Assegna messaggio in cui si è verificato l'errore e il nome della variabile di cui il tipo non è corretto. Puoi trovare entrambi questi elementi nell'elemento faultstring della risposta all'errore. Ad esempio, nel seguente faultstring, il nome del criterio è GenerateGeocodingRequest e la variabile è PostalCode:
"faultstring":"AssignMessage[GenerateGeocodingRequest]: value of variable PostalCode is not of type Message"
Nel file XML della regola di assegnazione del messaggio non riuscita, verifica che il nome della variabile impostata nell'elemento <Copy> corrisponda al nome della variabile identificato nella stringa di errore (passaggio 1 sopra). Ad esempio, la seguente norma imposta un attributo di origine su una variabile denominata PostalCode, che corrisponde a quanto indicato in faultstring:
Determina se questa variabile è di tipo messaggio o meno:
Individua il codice nel bundle del proxy API, dove la variabile è stata definita per la prima volta.
Una volta individuato il criterio in cui la variabile è definita e compilata per la prima volta, devi determinare il tipo di variabile come segue:
Controlla il valore dell'attributo type (se presente).
Se l'attributo type non è presente, la variabile viene considerata una stringa.
Se il tipo della variabile non è un messaggio (ad esempio una stringa), è la causa dell'errore. Per saperne di più sulle variabili comuni e sui relativi tipi, consulta la documentazione di riferimento sulle variabili.
Ad esempio, guarda la variabile PostalCode nel codice XML riportato sopra. Viene assegnato il valore della variabile di flusso request.queryparam.postalcode nell'elemento <AssignVariable>. Questo valore è una stringa, perché non è presente alcun attributo type nell'assegnazione della variabile.
Ora ricorda che la variabile PostalCode viene utilizzata nell'elemento <Copy> del criterio Assegna messaggio:
Poiché PostalCode non è di tipo messaggio (in questo esempio è una stringa), ricevi il codice di errore:
steps.assignmessage.VariableOfNonMsgType
Risoluzione
Assicurati che l'attributo source nell'elemento <Copy> del criterio Assegna messaggio non riuscito sia impostato su una variabile di flusso di tipo message esistente.
Per correggere il criterio, puoi modificare l'attributo source nell'elemento <Copy> per specificare una variabile di tipo messaggio. Ad esempio, se il criterio Assegna messaggio deve essere eseguito nel flusso di richiesta, puoi utilizzare la variabile di tipo di messaggio request o qualsiasi altra variabile personalizzata di tipo messaggio.
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 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"]]