Hi Matthijs,
The error suggests that the counterInput channel you are trying to use does not support clocked operations. Thus, you can't use "startForeground" and "starBackground" operations. Instead of this, you will have to use the on-demand operations like "inputSingleScan" and "outputSingleScan".
If this is not ideal, depending upon the use-case and Hardware's capability, you can you AnalogInput channels to capture the data. That being said, you have to do some data processing if this approach is used. Again, using this approach depends upon the end goal and hardware's capability.