Error 1502 When Building an Application in LabVIEW

Updated Aug 19, 2024

Reported In

Software

  • LabVIEW Application Builder Module
  • LabVIEW

Issue Details

I get Error 1502 when trying to build an application with LabVIEW:

A VI broke during the build process from being saved without a block diagram. Either open the build specification to include the block diagram of that VI or enable debugging to include the block diagrams of all VIs in the build. Report this error to National Instruments technical support.

<File Path>

Error 1502 occurred at AB_Source_VI.lvclass:Close_Reference.vi -> AB_Build.lvclass:Save.vi

Possible reason(s):
LabVIEW: (Hex 0x5DE) Cannot save a bad VI without its block diagram.

 
error1502.png

Solution

Error 1502 occurs when the Application Builder attempts to load VI dependencies or block diagrams due to a weak link to certain required components. 

There are several settings in the application (EXE) build properties dialog box which typically can help resolve this issue. Changing these settings will significantly increase the compile time, and size of the executable. However, it will not greatly affect execution speed. There can also be specific steps to take if certain toolkits or add-ons are being used and its VIs are reported in the file path mentioned by the error description. The following are different suggestions you can try to resolve this error.
 
  • Enable debugging in the Advanced category. Checking this option will include block diagrams that will greatly increase the application size (by approximately double), but can resolve this error.
 
 
  • Include the front panel and block diagram of the VI that is causing the error. Navigate to the Source File Settings category and select the VI that is causing the error. Uncheck the Remove block diagram box. If the VI is not listed in the Project Files section, then select Dependencies. Uncheck the Remove front panel and Remove block diagram boxes
 
 
  • Uncheck the following settings in Additional Exclusions as seen in the screenshot below: Disconnect type definitions and Remove unused members of project libraries. 
 
 
  • If you get this error while building an example of the LabVIEW Sound and Vibration Toolkit, make sure that you unchecked the Additional Exclusions mentioned in the previous bullet point, to avoid removing important dependencies used by the toolkit. 
 
  • This problem could be occurring if there are dependencies from a previous run time of LabVIEW that have been deprecated for your current version. Perform a mass compile your project following the indications provided in How to Mass Compile in LabVIEW.
 
  • This can be caused caused by building an application from a VI that has code that will never execute, for example, having a constant wired to the selector terminal of a case structure. In addition, this may be caused by deleting or removing SubVIs and dependencies from the project that may still be loaded in memory.
    • If you continue to run into issues with your subVIs not executing after resolving this error, try unchecking Remove unused polymorphic VI instances and Disconnect unused inline subVIs under the Additional Exclusions section when building your executable.
 
  • Error 1502 can sometimes also occur if there are Diagram Disable structures or Conditional Structure Code. It is advised to remove from the block diagram any code that will not be used. For example, code that is in the disabled case of a Diagram Disable structure. It is also recommended to explicitly include code from project dependencies.
 
  • If you have Community access scoped resources being used with Malleable VIs (.vim files) in friend libraries, try setting the resource's access setting to Public or have all required resources in a single library instead, there have been issues with the consistency of access permission of VIMs.  
 
  • If you are seeing this error while building a real-time application that communicates with an FPGA, and it is calling it by bitfile reference, try refreshing the FPGA VI reference in your RT main VI:
1. Open the block diagram.
2. Right-click the Open FPGA VI Reference Function and select Configure>>Deselect Bitfile>>OK then right-click the Open FPGA VI Reference Function and select Configure>>Select Bitfile again to refresh the reference. 
3. Save your VI and try building the application again.  
 
  • Error 1502 can occur if you have used LabVIEW State Diagram Toolkit to construct a state machine in your program.
1. Right-click the state machine loop and select Unlock Code From Editor Wizard.
2. Find all Integer to Enum nodes and replace them with Variant To Data nodes.
 
  • If your application uses a function from the JSONtext toolkit by JDP Science, then uncheck Apply prefix to all contained items (Source File Settings>>Dependencies>> Uncheck Apply prefix to all contained items option).
  
  •  If the Report Generation Toolkit is involved in the error, try the following:
1. In the LabVIEW Project Explorer, expand the Dependencies, and find the toolkit libraries and classes. 
 
rgtlibsclasses.png

2. Right-click on the class/library and select Explore.
3. From the opened File Explorer window drag and drop the mentioned libraries/classes into the LabVIEW project.
4. Create a new executable and add the mentioned libraries and classes into the Always included tab.
5. Build the executable. If you receive an error related to broken VIs from the during the creation of the executable, refer to: LabVIEW Report Generation Toolkit VIs Broken

Additional Information

When building an application, the first step that LabVIEW does is to make a copy of the code as a source distribution to a new directory, along with changing settings for the purpose of compiling into a single EXE file. Error 1502 occurs when something in that process goes wrong. This is caused by weak links which can occur from several things such as Diagram Disable Structures, bad dependencies, etc...