{"record":{"id":"8806c50528a881dd","repo":"thanos-io/thanos","slug":"failed-to-send-samples","errorCode":null,"errorMessage":"failed to send samples","messagePattern":"failed to send samples","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/limiter.go","lineNumber":190,"sourceCode":"\t\tseriesCount = 1\n\t\tchunksCount = uint64(len(series.Chunks))\n\t} else if batch := response.GetBatch(); batch != nil {\n\t\tfor _, series := range batch.Series {\n\t\t\tif series == nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tseriesCount++\n\t\t\tchunksCount += uint64(len(series.Chunks))\n\t\t}\n\t} else {\n\t\treturn i.Store_SeriesServer.Send(response)\n\t}\n\n\tif err := i.seriesLimiter.Reserve(seriesCount); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to send series\")\n\t}\n\tif err := i.samplesLimiter.Reserve(chunksCount * MaxSamplesPerChunk); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to send samples\")\n\t}\n\n\treturn i.Store_SeriesServer.Send(response)\n}\n","sourceCodeStart":172,"sourceCodeEnd":195,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/limiter.go#L172-L195","documentation":"limiterStore's Send wraps the samplesLimiter.Reserve error with \"failed to send samples\"; the estimated sample count is chunksCount * MaxSamplesPerChunk and exceeding the configured chunk/sample limit aborts the response. This protects downstream queriers from huge chunk loads.","triggerScenarios":"Streaming a Series response whose chunks, converted to estimated samples (chunks * MaxSamplesPerChunk), exceed the samples/chunks limiter limit.","commonSituations":"Long time ranges with high-resolution data in one query; --store.chunk-limit set too low; queries hitting many blocks at once.","solutions":["Shorten the query time range or lower data resolution/downsampling usage.","Increase --store.chunk-limit on store-gateway/query.","Split the query into smaller ranges (query sharding / time partitioning).","Verify downsampling is enabled so long ranges use downsampled blocks."],"exampleFix":"// before\nquery_range:start=now-30d, step=15s\n// after\nquery_range:start=now-7d, step=60s  # or rely on 5m downsampled blocks","handlingStrategy":"validation","validationCode":"// estimate samples: chunks ≈ range/step; ensure under limit\nif uint64(estimatedChunks)*MaxSamplesPerChunk > samplesLimit { /* reduce range or raise limit */ }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"failed to send samples\") {\n  // retry with shorter time range or coarser step\n}","preventionTips":["Enable downsampling so long ranges use 5m/1h blocks","Keep step sizes coarse for long query ranges","Tune chunk-limit from measured per-query chunk counts"],"tags":["go","limits","chunks"],"backgroundTag":"rate-limit-exceeded","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"}