MERGE operator: undefined symbol 'CAN'

I am processing several images in for loop. Each product is in ‘.SEN3’ format.
Suppose in i^th iteration I have a product stored in the variable ‘product’. One of the processing steps is to merge another product (which contains a mask) stored in the variable ‘mask_product’ with ‘product’. The following code is used for this purpose:

sourceProducts= HashMap()
sourceProducts.put(‘masterProduct’, product)
sourceProducts.put(‘slaveProduct’, mask_product)
parameters = HashMap()
parameters.put(‘geographicError’,‘NaN’)
product = GPF.createProduct(‘Merge’, parameters, sourceProducts)

This step works fine for most of the products, but for a few products I get the error;

RuntimeError: java.lang.IllegalArgumentException: expression: Undefined symbol ‘CAN’

I have not been able to figure out why this error would occur. Any suggestions?

P.S. ‘CAN’ is one of the masks in ‘mask_product’.

Difficult to say.
Maybe one of the mask products doe not have this mask or is somehow not properly generated? Have you checked it in SNAP?

Thanks Marco. Yes, I have checked it in SNAP. Mask product is fine. Since same mask product is being merged with each of products.