{"record":{"id":"b4b3117d4e691607","repo":"SigNoz/signoz","slug":"maximum-traces-that-can-be-paginated-is-10000","errorCode":null,"errorMessage":"maximum traces that can be paginated is 10000","messagePattern":"maximum traces that can be paginated is 10000","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/query-service/app/querier/querier.go","lineNumber":358,"sourceCode":"\n\tlimitWithOffset := limit + offset\n\tif isLogs {\n\t\t// for logs we use pageSize to define the current limit and limit to define the absolute limit\n\t\tlimitWithOffset = pageSize + offset\n\t\tif limit > 0 && offset >= limit {\n\t\t\treturn nil, nil, fmt.Errorf(\"max limit exceeded\")\n\t\t}\n\t}\n\n\tfor _, v := range tsRanges {\n\t\tparams.Start = v.Start\n\t\tparams.End = v.End\n\t\tlength := uint64(0)\n\n\t\t// max limit + offset is 10k for pagination for traces/logs\n\t\t// TODO(nitya): define something for logs\n\t\tif !isLogs && limitWithOffset > constants.TRACE_V4_MAX_PAGINATION_LIMIT {\n\t\t\treturn nil, nil, fmt.Errorf(\"maximum traces that can be paginated is 10000\")\n\t\t}\n\n\t\t// we are updating the offset and limit based on the number of traces/logs we have found in the current timerange\n\t\t// eg -\n\t\t// 1)offset = 0, limit = 100, tsRanges = [t1, t10], [t10, 20], [t20, t30]\n\t\t//\n\t\t// if 100 traces/logs are there in [t1, t10] then 100 will return immediately.\n\t\t// if 10 traces/logs are there in [t1, t10] then we get 10, set offset to 0 and limit to 90, search in the next timerange of [t10, 20]\n\t\t// if we don't find any trace in [t1, t10], then we search in [t10, 20] with offset=0, limit=100\n\n\t\t//\n\t\t// 2) offset = 50, limit = 100, tsRanges = [t1, t10], [t10, 20], [t20, t30]\n\t\t//\n\t\t// If we find 150 traces/logs with limit=150 and offset=0 in [t1, t10] then we return immediately 100 traces/logs\n\t\t// If we find 50 in [t1, t10] with limit=150 and offset=0 then it will set limit = 100 and offset=0 and search in the next timerange of [t10, 20]\n\t\t// if we don't find any trace in [t1, t10], then we search in [t10, 20] with limit=150 and offset=0\n\n\t\tparams.CompositeQuery.BuilderQueries[qName].Offset = 0","sourceCodeStart":340,"sourceCodeEnd":376,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/querier/querier.go#L340-L376","documentation":"For traces list pagination, the sum of limit + offset (or pageSize + offset for logs) must not exceed TRACE_V4_MAX_PAGINATION_LIMIT (10000). This protects the trace store from unbounded windowed pagination scans.","triggerScenarios":"Calling QueryRange with a traces List panel where limitWithOffset exceeds 10000, e.g. limit=9500 with offset=1000, or logs with pageSize+offset beyond the cap when isLogs is false path (traces).","commonSituations":"Scripting or UI pagination that walks deep into trace results; exporting large trace lists; misconfigured page size multiplied by page count over 10000.","solutions":["Cap limit+offset at 10000: reduce page size or page shallower","Use time-range windows or filters instead of deep offset pagination to reach older traces","If you truly need more than 10k traces, page over narrower time ranges (the API already windows internally) or export directly from ClickHouse"],"exampleFix":"// before\nparams.Limit, params.Offset = 9500, 1000\n// after\nconst maxPagination = 10000\nif params.Limit+params.Offset > maxPagination {\n    params.Limit = maxPagination - params.Offset\n}","handlingStrategy":"validation","validationCode":"const maxPagination = 10000\nif params.Limit+params.Offset > maxPagination {\n    params.Limit = maxPagination - params.Offset\n    if params.Limit <= 0 { /* narrow time range instead */ }\n}","typeGuard":"func withinTracePaginationLimit(limit, offset uint64) bool { return limit+offset <= 10000 }","tryCatchPattern":null,"preventionTips":["Cap page*pageSize at 10000","Use time-range windows or filters instead of deep offset pagination"],"tags":["traces","pagination","limit"],"backgroundTag":"pagination-limit-exceeded","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}