Documentation

Troubleshoot issues writing data

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

Handle write responses

InfluxDB Cloud Dedicated does the following when you send a write request:

  1. Validates the request.

  2. If successful, attempts to ingest data from the request body; otherwise, responds with an error status.

  3. Ingests or rejects data in the batch and returns one of the following HTTP status codes:

    • 204 No Content: all data in the batch is ingested
    • 201 Created (If the cluster is configured to allow partial writes): some points in the batch are ingested and queryable, and some points are rejected
    • 400 Bad Request: all data is rejected

The response body contains error details about rejected points, up to 100 points.

Writes are synchronous–the response status indicates the final status of the write and all ingested data is queryable.

To ensure that InfluxDB handles writes in the order you request them, wait for the response before you send the next request.

Review HTTP status codes

InfluxDB uses conventional HTTP status codes to indicate the success or failure of a request. The message property of the response body may contain additional details about the error. InfluxDB Cloud Dedicated returns one the following HTTP status codes for a write request:

HTTP response codeResponse bodyDescription
201 "Created"error details about rejected points, up to 100 points: line contains the first rejected line, message describes rejectionsIf partial writes are configured for the cluster, and if some of the data is ingested and some of the data is rejected
204 No Content"no response bodyIf InfluxDB ingested all of the data in the batch
400 "Bad request"error details about rejected points, up to 100 points: line contains the first rejected line, message describes rejections lineIf request data is malformed
401 "Unauthorized"If the Authorization header is missing or malformed or if the token doesn’t have permission to write to the database. See examples using credentials in write requests.
404 "Not found"requested resource type (for example, “organization” or “database”), and resource nameIf a requested resource (for example, organization or database) wasn’t found
500 "Internal server error"Default status for an error
503 "Service unavailable"If the server is temporarily unavailable to accept writes. The Retry-After header contains the number of seconds to wait before trying the write again.

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

Troubleshoot failures

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

Troubleshoot rejected points

When writing points from a batch, InfluxDB rejects points that have syntax errors or schema conflicts. If InfluxDB processes the data in your batch and then rejects points, the HTTP response body contains the following properties that describe rejected points:

  • code: "invalid"
  • line: the line number of the first rejected point in the batch.
  • message: a string that contains line-separated error messages, one message for each rejected point in the batch, up to 100 rejected points.

InfluxDB rejects points for the following reasons:

  • a line protocol parsing error
  • an invalid timestamp
  • a schema conflict

Schema conflicts occur when you try to write data that contains any of the following:

  • a wrong data type: the point falls within the same partition (default partitioning is measurement and day) as existing bucket data and contains a different data type for an existing field
  • a tag and a field that use the same key

Example

The following example shows a response body for a write request that contains two rejected points:

{
  "code": "invalid",
  "line": 2,
  "message": "failed to parse line protocol:
              errors encountered on line(s):
              error parsing line 2 (1-based): Invalid measurement was provided
              error parsing line 4 (1-based): Unable to parse timestamp value '123461000000000000000000000000'"
}

Check for field data type differences between the rejected data point and points within the same database and partition–for example, did you attempt to write string data to an int field?


Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following: