Error Code -200479 When Running a NI-DAQ™mx Application

Updated Aug 14, 2023

Reported In


  • LabVIEW


  • NI-DAQmx

Programming Language

  • Python

Issue Details

I am using the DAQmx Start and DAQmx or DAQmx functions to acquire or generate data. When I run my program, I receive the following error message: Error -200479 Specified operation cannot be performed while the task is running



This particular error occurs when a task's state is set to Running when it is already in the Running state. There are three common scenarios where this error may show up:
  • Referencing the same task twice, and attempting to start both before stopping one of them
  • Placing a DAQmx Start inside a while loop without stopping the previous instance of the task
  • Placing a DAQmx or a DAQmx before a DAQmx Start and setting Autostart to False
You can avoid this error by starting and clearing the task outside of the While loop, and ensuring that the DAQmx is not called before the DAQmx, as in the example below:

If a DAQmx Start is placed inside a While loop without stopping or clearing the task, on every successive iteration of the While loop the task will attempt to start a task that is already Running. In order to avoid this, make sure that you stop or clear the task before it is restarted using the DAQmx Stop or DAQmx Clear Typically, starting and stopping the task outside of the While loop will avoid this error and improve driver performance as there are less state transitions taking place. 

Additional Information

When using the DAQmx Python API, you may encounter a similar issue. Below is a small code snippet that demonstrates the problem. When the commented line is executed, an error message will appear due to the auto_start parameter being set to True.
DataStream = nidaqmx.stream_writers.AnalogSingleChannelWriter(task.out_stream, auto_start=True)
# task.start()

Understanding the source of this error involves understanding the NI-DAQmx Task State Model. NI-DAQmx uses the Task State Model to improve ease of use and speed up driver performance. The Task State Model consists of five states: UnverifiedVerifiedReservedCommitted, and Running. For more information about the Task State Model refer to the Related Links.

When a task begins to perform an operation, the task transitions to the Running state. You can explicitly perform this transition by invoking the DAQmx Start, however, starting a task does not necessarily begin acquiring samples or generating data. It is important to note that if a DAQmx or DAQmx is called, it will automatically start the task and transition the task into the Running state. If the DAQmx Start is called after either one of these functions, it will be trying to start a task that is already in the Running state. In order to avoid this error, ensure that the DAQmx Start is not called after your task has begun acquiring or generating data.