This content is not available in your preferred language.

The content is shown in another available language. Your browser may include features that can help translate the text.

Error -1073807346: Given Session or Object Reference Invalid in NI VISA

Updated Aug 24, 2023

Reported In

Software

  • LabVIEW
  • Measurement & Automation Explorer (MAX)

Driver

  • NI-VISA

Issue Details

  • I have distributed a LabVIEW executable that controls hardware. The code works on my development PC, but when I deploy it, I receive error -1073807346. Why is this happening?
    When I attempt to open a new VISA session to my instrument or use an existing session, I receive Error – 1073807346 VISA: (Hex 0xBFFF000E) The given session or object reference is invalid.



 

Solution

This error can happen for a number of reasons:

  • Missing driver: Install the correct driver and version for the hardware. For NI hardware, this information can be found under Supported Devices in the driver version's readme.​​​​​​

  • Incorrect Addressing: Verify that the instrument is being addressed correctly.

    • Ensure that LabVIEW is using the same Resource Name as shown in the following: 

      • Windows: NI MAX on the main configuration page (Settings) of your VISA resource. 

      • Mac/Linux: Refer to Communicate with Third-Party Instrument in Linux.

      • If you are currently using VISA Alias, try using the VISA Resource Name.

        • For example: using the Resource Name, ​ASRL3::INSTR, instead of the Alias, "COM3"

  • Device Not Powered On: Verify that the device is connected correctly and powered on.

  • VISA Session Was Previously Closed: This error can also occur if the VISA session was unexpectedly closed during communication. The most common case in which this can happen is if the VISA resource is stored in a Global Variable. Disabling the Automatically Close VISA Sessions option can prevent the error:​​​ Note: If disabling this option, then ensure that VISA Close is called when device communication finishes.

    1. Select Tools » Options to display the Options dialog box. 

    2. Select Environment from the Category list.

    3. Uncheck the Automatically Close VISA Sessions checkbox.

    4. Select OK.

  • Incorrect Build Specification: If building and deploying an executable, ensure that:

    1. The instrument driver VIs are included in the LabVIEW Project.

    2. The instrument driver VIs are set as "Always Included" in the Source Files tab of the Build Specifications.

    3. If using a 3rd party device, ensure that the device has been configured for remote control if applicable.

Additional Information

The Automatically Close VISA Sessions option allows open VISA sessions to close automatically when the top-level VI goes idle. This option helps to avoid potential problems the next time the VI is executed. As a result, when the VISA session is accessed via a Global Variable, an invalid VISA session error will be returned as long as this option is enabled.