Influx write: Failed to write data: <html>

I am trying to migrate my databases from InfluxDB 1.8 to 2.0 (on different machines) using this tutorial (Manually upgrade from InfluxDB 1.x to 2.0 | InfluxDB OSS 2.0 Documentation).

I have successfully exported my database, but on trying to import it I get the following error message:

root@influxdb2:/var/lib/influxdb2# influx write --bucket plants --file /var/lib/influxdb2/export
.rror: Failed to write data: <html>
Error: Invalid character '<' looking for beginning of value.
See 'influx write -h' for help

I have checked the file and it is clean. It does not contain any tags, only formatted lines with data. A dryrun does show all the data within the file and does not prompt any errors. I am unable to determine what this error message refers to. So far I have not been able to find any posts related to this issue. Any help is greatly appreciated.

@michaelbeljaars I’ve seen similar situations in other commands where:

  1. The CLI makes a request against a server that doesn’t know our V2 APIs (in other words, not InfluxDB v2)
  2. The server responds with a generic 404 page in HTML
  3. The CLI explodes trying to parse the response, because it expects JSON

You can sanity-check your CLI configuration by explicitly specifying --host <your-influxdb2-url> in your influx write call. If the error doesn’t reproduce when overriding the host, something is wrong in your CLI configs.

You might also want to download the latest release of our stand-alone CLI (links on GitHub here), as it added support for a --http-debug flag that will allow you to see the raw request/response traffic passing through the CLI.