If this happens please check the document versions first of all to determine in which version it was that the variables stopped being replaced.
Once you have determined when this happened then view the audit trail of your document and review the activity that happened between the version in which the variables were replaced and the version in which this stopped happening.
It is highly likely that the document was downloaded at this point and then uploaded with the variables replaced, therefore removing the option of variable replacement from the Document.
When working with documents with variables all changes need to be done in live edit to preserve the variables or if a new document is uploaded it should contain the variables and not the replaced variables.
Another thing to take note of is the type of variable being used. When using any text area or table type of variable, you must include a line break and eliminate any blank space after the variable.
This is crucial as the system relies on a clearly defined space between the original value and the variable. Failure to provide adequate line breaks or space can lead to issues with variable replacement.