{"record":{"id":"fc7f2bbf4957a675","repo":"thanos-io/thanos","slug":"please-call-next-before-at","errorCode":null,"errorMessage":"please call Next before At","messagePattern":"please call Next before At","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/store/proxy_merge.go","lineNumber":387,"sourceCode":"\t\tl.dataOrFinishEvent.Wait()\n\t\tif l.noMoreData && l.rb.isEmpty() {\n\t\t\tbreak\n\t\t}\n\t}\n\n\tif !l.rb.isEmpty() {\n\t\tl.lastResp = l.rb.pop()\n\t\treturn true\n\t}\n\n\tl.lastResp = nil\n\treturn false\n}\n\nfunc (l *lazyRespSet) At() *storepb.SeriesResponse {\n\t// NB: don't need hold l.responsesMtx lock here, because a call site must not call At() and Next() concurrently.\n\tif !l.initialized {\n\t\tpanic(\"please call Next before At\")\n\t}\n\n\treturn l.lastResp\n}\n\nfunc (l *lazyRespSet) Close() {\n\tl.bufferedResponsesMtx.Lock()\n\tl.closeSeries()\n\tl.rb.close()\n\tl.noMoreData = true\n\tl.dataOrFinishEvent.Signal()\n\tl.bufferedResponsesMtx.Unlock()\n\n\t<-l.donec\n\n\tl.shardMatcher.Close()\n\t_ = l.cl.CloseSend()\n}","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/store/proxy_merge.go#L369-L405","documentation":"A deliberate guard panic in the lazyRespSet iterator: At() was called before Next() had ever returned true, so l.lastResp is nil/uninitialized. This is iterator-protocol misuse by the caller, not a data or store problem — the series stream itself is fine.","triggerScenarios":"Thrown at pkg/store/proxy_merge.go:387 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the calling code to only call At() after Next() returns true","Check series-set iteration loops for calling At() on an untouched or exhausted set"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}