Documentation

Troubleshoot issues writing data

Learn how to handle and recover from errors when writing to InfluxDB.

Discover common failure scenarios

Write requests made to InfluxDB may fail for a number of reasons. Common failure scenarios that return an HTTP 4xx or 5xx error status code include the following:

To find the causes of a specific error, review HTTP status codes.

Troubleshoot partial writes

Writes may fail partially or completely even though InfluxDB returns an HTTP 2xx status code for a valid request. To resolve partial writes and rejected points, see troubleshoot failures.

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: InfluxDB validated the request data format and accepted the data for writing to the bucket.

    204 doesn’t indicate a successful write operation given writes are asynchronous. If some of your data did not write to the bucket, see how to check for rejected points.

  • 400 Bad request: InfluxDB rejected some or all of the request data. code and message in the response body provide details about the problem. For more information, see how to troubleshoot rejected points.
  • 401 Unauthorized: May indicate one of the following:
  • 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: Occurs in the following cases:
    • The write request payload exceeds the size limit 50 MB (compressed or uncompressed).
    • A compressed payload attempts to uncompress more than 250 MB of data.
  • 429 Too many requests: API token is temporarily over quota. The Retry-After header describes when to try the write request again.
  • 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.

Troubleshoot failures

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

Troubleshoot rejected points

InfluxDB may have rejected points even if the HTTP request returned “Success”. InfluxDB logs rejected data points and associated errors to your organization’s _monitoring bucket.

Review rejected points

To get a log of rejected points, query the rejected_points measurement in your organization’s _monitoring bucket. To more quickly locate rejected_points, keep the following in mind:

  • If your line protocol batch contains single lines with multiple fields, InfluxDB logs an entry for each point (each unique field) that is rejected.
  • Each entry contains a reason tag that describes why the point was rejected.
  • Entries for data type conflicts and schema rejections have a count field value of 1.
  • Entries for parsing errors contain an error field (and don’t contain a count field).

rejected_points schema

NameValue
_measurementrejected_points
_fieldcount or error
_value1 or error details
bucketID of the bucket that rejected the point
measurementMeasurement name of the point
fieldName of the field that caused the rejection
reasonBrief description of the problem. See specific reasons in field type conflicts and schema rejections.
gotTypeReceived field type: Boolean, Float, Integer, String, or UnsignedInteger
wantTypeExpected field type: Boolean, Float, Integer, String, or UnsignedInteger
<timestamp>Time the rejected point was logged

Find parsing errors

If InfluxDB can’t parse a line (e.g. due to syntax problems), the response message might not provide details. To find parsing error details, query rejected_points entries that contain the error field (instead of the count field).

from(bucket: "_monitoring")
  |> range(start: -1h)
  |> filter(fn: (r) => r._measurement == "rejected_points")
  |> filter(fn: (r) => r._field == "error")

Find data type conflicts and schema rejections

To find rejected_points caused by data type conflicts or schema rejections, query for the count field.

from(bucket: "_monitoring")
  |> range(start: -1h)
  |> filter(fn: (r) => r._measurement == "rejected_points")
  |> filter(fn: (r) => r._field == "count")

Resolve data type conflicts

When you write to a bucket that has the implicit schema type, InfluxDB compares new points to points that have the same series. If a point has a field with a different data type than the series, InfluxDB rejects the point and logs a rejected_points entry. The rejected_points entry contains one of the following reasons:

ReasonMeaning
type conflict in batch writeThe batch contains another point with the same series, but one of the fields has a different value type.
type conflict with existing dataThe bucket contains another point with the same series, but one of the fields has a different value type.

Resolve explicit schema rejections

Buckets with the [explicit schema type] use explicit bucket schemas. When you write to a bucket that uses explicit bucket schemas, InfluxDB rejects data that don’t conform to one of the configured schemas.

Learn how to interpret rejected_points logging for explicit bucket schemas.

Detect a measurement mismatch

InfluxDB rejects a point if the measurement doesn’t match the name of a bucket schema. The rejected_points entry contains the following reason tag value:

ReasonMeaning
measurement not allowed by schemaThe bucket is configured to use explicit schemas and none of the schemas matches the measurement of the point.

Consider the following line protocol data.

airSensors,sensorId=TLM0201 temperature=73.97,humidity=35.23,co=0.48 1637014074

The line has an airSensors measurement and three fields (temperature, humidity, and co). If you try to write this data to a bucket that has the explicit schema type and doesn’t have an airSensors schema, the /api/v2/write InfluxDB API returns an error and the following data:

{
  "code": "invalid",
  "message": "3 out of 3 points rejected (check rejected_points in your _monitoring bucket for further information)"
}

InfluxDB logs three rejected_points entries, one for each field.

_measurement_field_valuefieldmeasurementreason
rejected_pointscount1humidityairSensorsmeasurement not allowed by schema
rejected_pointscount1coairSensorsmeasurement not allowed by schema
rejected_pointscount1temperatureairSensorsmeasurement not allowed by schema
Detect a field type mismatch

InfluxDB rejects a point if the measurement matches the name of a bucket schema and the field data types don’t match. The rejected_points entry contains the following reason:

ReasonMeaning
field type mismatch with schemaThe point has the same measurement as a configured schema and they have different field value types.

Consider a bucket that has the following airSensors explicit bucket schema:

{
 "name": "airSensors",
 "columns": [
   {
     "name": "time",
     "type": "timestamp"
   },
   {
     "name": "sensorId",
     "type": "tag"
   },
   {
     "name": "temperature",
     "type": "field",
     "dataType": "float"
   },
   {
     "name": "humidity",
     "type": "field",
     "dataType": "float"
   },
   {
     "name": "co",
     "type": "field",
     "dataType": "float"
   }
 ]
}

The following line protocol data has an airSensors measurement, a sensorId tag, and three fields (temperature, humidity, and co).

airSensors,sensorId=L1 temperature=90.5,humidity=70.0,co=0.2 1637014074
airSensors,sensorId=L1 temperature="90.5",humidity=70.0,co=0.2 1637014074

In the example data, one of the points has a temperature field value with the string data type. However, the airSensors schema requires temperature to have the float data type. If you try to write the example data to the airSensors bucket schema, InfluxDB returns a 400 error and a message that describes the result:

{
  "code": "invalid",
  "message": "partial write error (5 accepted): 1 out of 6 points rejected (check rejected_points in your _monitoring bucket for further information)"
}

InfluxDB logs the following rejected_points entry to the _monitoring bucket:

_measurement_field_valuebucketfieldgotTypemeasurementreasonwantType
rejected_pointscount1a7d5558b880a93datemperatureStringairSensorsfield type mismatch with schemaFloat

Select your region

Upgrade to InfluxDB Cloud or InfluxDB 2.0!

InfluxDB Cloud and InfluxDB OSS 2.0 ready for production.