Error -2501 Invalid TDMS File Reference in LabVIEW

Updated May 24, 2022

Reported In

Software

  • LabVIEW

Issue Details

I have a LabVIEW code that is logging data to a TDMS file. Randomly, I am getting the following error.

 LabVIEW: (Hex 0xFFFFF63B) Invalid TDMS file reference.
 
Screenshot_1.png
 

Solution

This error occurs when a TDMS function (i.e TDMS Write or TDMS Read) receives an invalid reference on its tdms file input. The following example simulates a common situation where this issue shows up.
Screenshot_1.png
The code is continuously logging random data to a TDMS file (test.tdms). Under regular conditions, the Write TDMS function receives the file reference that was created with the TMDS Open function. To simulate a situation where the file reference is lost, a case structure controlled by the Close Ref button was added. Once this button is pressed, the initial reference is closed. In the next iteration, the Write TDMS function will receive an invalid reference causing the -2501 error.