Troubleshoot issues writing data

This page documents an earlier version of InfluxDB. InfluxDB v2.7 is the latest stable version. View this page in the v2.7 documentation.

Learn how to avoid unexpected results and recover from errors when writing to InfluxDB.

Handle write and delete responses

If InfluxDB OSS successfully writes all the request data to the bucket, InfluxDB returns success (HTTP 204 status code). The first rejected point in a batch causes InfluxDB to reject the entire batch and respond with an HTTP error status.

Review HTTP status codes

InfluxDB uses conventional HTTP status codes to indicate the success or failure of a request. Write requests return the following status codes:

  • 204 Success: All request data was written to the bucket.
  • 400 Bad request: The line protocol data in the request was malformed. The response body contains the first malformed line in the data. All request data was rejected and not written.
  • 401 Unauthorized: May indicate one of the following:
    • Authorization: Token header is missing or malformed.
    • API token value is missing from the header.
    • API token does not have sufficient permissions to write to the organization and the bucket. For more information about token types and permissions, see Manage API tokens.
  • 404 Not found: A requested resource (e.g. an organization or bucket) was not found. The response body contains the requested resource type, e.g. “organization”, and resource name.
  • 413 Request entity too large: All request data was rejected and not written. InfluxDB OSS only returns this error if the Go (golang) ioutil.ReadAll() function raises an error.
  • 500 Internal server error: Default HTTP status for an error.
  • 503 Service unavailable: Server is temporarily unavailable to accept writes. The Retry-After header describes when to try the write again.

The message property of the response body may contain additional details about the error. If some of your data did not write to the bucket, see how to troubleshoot rejected points.

Troubleshoot failures

If you notice data is missing in your bucket, do the following:

Troubleshoot rejected points

InfluxDB rejects points for the following reasons:

  • The batch contains another point with the same series, but one of the fields has a different value type.
  • The bucket contains another point with the same series, but one of the fields has a different value type.

Check for field type differences between the missing data point and other points that have the same series–for example, did you attempt to write string data to an int field?

write line protocol errors