{"record":{"id":"c8f4015e777e7ea2","repo":"thanos-io/thanos","slug":"internal","errorCode":"Internal","errorMessage":"chunk iter","messagePattern":"chunk iter","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/tsdb.go","lineNumber":375,"sourceCode":"\t\t\tframeBytesLeft -= c.Size()\n\t\t\tseriesChunks = append(seriesChunks, c)\n\n\t\t\t// We are fine with minor inaccuracy of max bytes per frame. The inaccuracy will be max of full chunk size.\n\t\t\tisNext = chIter.Next()\n\t\t\tif frameBytesLeft > 0 && isNext {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif err := srv.Send(storepb.NewSeriesResponse(&storepb.Series{Labels: storeSeries.Labels, Chunks: seriesChunks})); err != nil {\n\t\t\t\treturn status.Error(codes.Aborted, err.Error())\n\t\t\t}\n\n\t\t\tif isNext {\n\t\t\t\tframeBytesLeft = bytesLeftForChunks\n\t\t\t\tseriesChunks = make([]storepb.AggrChunk, 0, len(seriesChunks))\n\t\t\t}\n\t\t}\n\t\tif err := chIter.Err(); err != nil {\n\t\t\treturn status.Error(codes.Internal, errors.Wrap(err, \"chunk iter\").Error())\n\t\t}\n\n\t}\n\tif err := set.Err(); err != nil {\n\t\treturn status.Error(codes.Internal, err.Error())\n\t}\n\tfor _, w := range set.Warnings() {\n\t\tif err := srv.Send(storepb.NewWarnSeriesResponse(w)); err != nil {\n\t\t\treturn status.Error(codes.Aborted, err.Error())\n\t\t}\n\t}\n\treturn srv.Flush()\n}\n\n// LabelNames returns all known label names constrained with the given matchers.\nfunc (s *TSDBStore) LabelNames(ctx context.Context, r *storepb.LabelNamesRequest) (\n\t*storepb.LabelNamesResponse, error,\n) {","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/tsdb.go#L357-L393","documentation":"After streaming series/chunks to the client, the Series handler checks the chunk querier iterator's error and, if non-nil, wraps it with 'chunk iter' and returns an Internal gRPC status. It signals the underlying TSDB chunk query failed mid-iteration, not a client mistake.","triggerScenarios":"The ChunkQuerier's chunk iterator (chIter.Err() != nil) errors during Series — e.g. corrupt index blocks, failed block reads, memory pressure closing the querier, or head compaction during the query.","commonSituations":"Corrupted or partially downloaded TSDB blocks in a store node, disk I/O failures, querying while compaction/deletion runs, or out-of-memory eviction killing iterators.","solutions":["Inspect the wrapped cause in the Internal status for the root error","Verify block integrity (thanos tools bucket verify) and re-download/repair corrupt blocks","Check disk health and free space on the store node","Retry the query; if persistent, remove or repair the affected block"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if status.Code(err) == codes.Internal && strings.Contains(err.Error(), \"chunk iter\") { log.Error(err); /* inspect wrapped cause, repair blocks or retry */ }","preventionTips":["Run periodic bucket verify / block integrity checks","Monitor disk health and head compaction on store nodes","Set querier query deadlines and retry transient Internal errors"],"tags":["grpc","internal","tsdb","chunk-querier"],"backgroundTag":"database-query-failed","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}