Warning: error of source variable is not cloneable

Dear Teneo Community,

I have come across a warning that I do not completely understand and cannot seem to get rid of: Value of source variable [emailBody] is not cloneable, transfering variable via reference.

Context: The warning occurs for a flow with two integrations, where the second integration sends the output of the first integration as an email to the user. I have a flow variable called emailBody, which is populated by the output of the first integration. Then I send emailBody as a parameter (bodyText) to the second integration.

Despite the warning, the flow performs as expected and the email is sent without errors and with the right content.

I have tried using a Global Variable for emailBody instead of the Flow Variable, but the warning persists.

Does anyone have an idea what I might be doing “wrong” and how to avoid this warning? Is it because I’m using two integrations? Or could it be a problem that emailBody (str) contains HTML code as a string, even though it all runs smoothly otherwise? Or do long strings (4386 chars) become a problem, for example in the logs?

If anyone has come across a similar error and knows how to resolve it, I’d really appreciate your input. Thank you very much in advance!

Update: I did just try to reduce the string to 50 characters, and the warning disappeared. So it was indeed the length of the string that was causing an issue.

Now that we’ve narrowed down the problem, does anyone know how I can pass long string variables to my integration without triggering this warning?

Hi Julia,

I think you can use Global variable directly in an integration without sending it as a parameter. So you can try to write the value of the Global variable emailBody in the first integration without sending it back to your flow. Just remember to reset the value after the second integration.


1 Like

Hi Chunlin,

Yes, that’s right, thank you! I just tried using the global variable directly in the Integration and the warning disppeared. That could be an easy workaround!

However, I’m currently building another flow with a similar structure (just more parameters) and I’m getting multiple of these warnings, even for shorter strings (40 char). I’d like to avoid setting up 10 global variables that I won’t need in any other flows. Is it possible to make this work with flow variables as well?

Also, I still don’t completely understand why exactly I’m getting this warning in the first place. Could someone explain what the underlying issue is and how I can prevent this from happening?

Thank you very much!

Hi Julia (@julia-suter) ,

this might not be directly related to the String size but it could be that the email body contained interpolation and actually was a GString object instead of a String object - see Groovy Documentation.
A GString would not be clonable, be passed by reference and not by value - leading to the warning that you mentioned.

In order to get rid of the warning, please try to call .toString() when you assign the value of emailBody to ensure its a String object.

In this specific case, we talk about ~4k characters inside your String, so passing it around can lead to an additional / unnecessary increase of the session logs. You can find valuable information on this topic here Data footprint | Teneo Developers and here Reducing Your Session Data Footprint - Knowledge Articles - Teneo Developers Community.

Maybe working with a Global Variable for your 4k characters variable is then a good option (possibly even inside a map as the second article reference suggest).

Hope this helps!