This is just a speculation.
Is the construct under a decide statement, then after the decide statement you are trying to reference it? Think of scope in C#, if you define a variable under an if statement, then that variable is not available outside the if statement.
I have had cases where I have to construct the message in the left side of an Decide shape/rule, then also build a dummy/empty message on the right side of the Decide shape (the else). The compiler doesn’t know which side of the decide shape will execute, and so both side have to construct the message, if you want to use the message after the decide shape.
Hope that helps. If not, please provide more details.