Import data from CSV: measurement column not found

Hi, I’m trying to import data from csv into my InfluxDb2 (v2.1) OSS installation on Kubernetes. Firstly I tried to upload through the “file upload” function in the UI, but I can’t see where to actually upload the file (there is no upload button?!). Secondly, I tried to import using the CLI as follows:

influx write -b default -f test.csv

and I get the following error for every line it tries to import:

2022/03/03 17:29:54 line 1: no measurement column found
2022/03/03 17:29:54 Unable to batcher to error-file: invalid argument

A sample from csv file:

#datatype dateTime:RFC3339,measurement,tag,int
time,measurement,loc,temp
2022-02-01T00:00:11Z,telemetry,home,23

Any ideas what’s wrong with this?

Your sample CSV works OK with a small change: int must be changed to long.
What is your version of influx cli? Try: influx version

I did resolve the previous issue by changing the value type to “long”. Now, I’m getting the same error message with a different file format:

#datatype measurement,dateTime:RFC3339,long,tag,tag,tag,tag
measurement,time,speed,thingId,componentName,componentId,componentIndex
component,2022-03-04T03:15:03Z,0,1,C1,20,020
component,2022-03-28T13:25:43Z,0,1,C2,18,018

Error messages from influx write command:

2022/04/26 15:59:58 line 2: no measurement column found
2022/04/26 15:59:58 line 3: no measurement column found
2022/04/26 15:59:58 Unable to batcher to error-file: invalid argument

Influx CLI version is 2.2.0

Any ideas what I’m doing wrong here?

Adding more info, the data shown above is the first 4 lines of a file with 175k records. If I create a test file with the first 4 or so lines (including header lines), it imports ok. If I try to import the full file it has the error messages, even if I have already successfully imported the same lines 2 and 3 that apparently have “no measurement column found”.

Could someone please confirm whether “line 2” in the error message is actually line 2 of the file, or line 4 (with first 2 lines being headers), or if the line reference is relative to some other position in the file? It’s possible there is invalid data in the file, but it’s obviously not in the first few rows.