• I found the issue. The case statement result is of type DT_STR. Putting that result into a DT_WSTR could cause data loss thus the error.

    I changed the data type to be string DT_STR in the file connection manager. Thanks