{"record":{"id":"4b975474607b3176","repo":"SigNoz/signoz","slug":"query-s-doesn-t-exist","errorCode":null,"errorMessage":"query %s doesn't exist","messagePattern":"query (.+?) doesn't exist","errorType":"http","errorClass":"model.ApiError","httpStatus":404,"severity":"warning","filePath":"pkg/query-service/app/clickhouseReader/query_progress/inmemory_tracker.go","lineNumber":87,"sourceCode":"\tif queryTracker != nil {\n\t\tdelete(tracker.queries, queryId)\n\t}\n\ttracker.lock.Unlock()\n\n\tif queryTracker != nil {\n\t\tqueryTracker.onFinished()\n\t}\n}\n\nfunc (tracker *inMemoryQueryProgressTracker) getQueryTracker(\n\tqueryId string,\n) (*queryTracker, *model.ApiError) {\n\ttracker.lock.RLock()\n\tdefer tracker.lock.RUnlock()\n\n\tqueryTracker := tracker.queries[queryId]\n\tif queryTracker == nil {\n\t\treturn nil, model.NotFoundError(fmt.Errorf(\n\t\t\t\"query %s doesn't exist\", queryId,\n\t\t))\n\t}\n\n\treturn queryTracker, nil\n}\n\n// Tracks progress and manages subscriptions for a single query\ntype queryTracker struct {\n\tlogger     *slog.Logger\n\tqueryId    string\n\tisFinished bool\n\n\tprogress      *model.QueryProgress\n\tsubscriptions map[string]*queryProgressSubscription\n\n\tlock sync.Mutex\n}","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/clickhouseReader/query_progress/inmemory_tracker.go#L69-L105","documentation":"NotFoundError from getQueryTracker when the requested queryId has no entry in the in-memory tracker — either the query was never registered via ReportQueryStarted, it already finished and was removed, or it was registered on a different query-service replica (the tracker is per-process, in-memory).","triggerScenarios":"Calling ReportQueryProgress or SubscribeToQueryProgress with a queryId that was never started, after postQueryCleanup removed it, or against a different instance behind a load balancer.","commonSituations":"Multi-replica query-service deployments where progress reports/subscription requests land on a different pod than the one running the query; subscribing after the query finished; stale IDs from a restarted service.","solutions":["Verify ReportQueryStarted succeeded and returned a cleanup func for that exact queryId","Subscribe/report before the query finishes and keep the ID from the start call","Use sticky routing (same client to same replica) or move to a shared tracker backend for multi-replica setups","Treat NotFound as terminal: don't loop retrying a finished query's progress"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Confirm the query is registered on this instance before reporting\nif _, apiErr := tracker.GetTracker(queryId); apiErr != nil {\n    return fmt.Errorf(\"query not tracked here; route to owning replica\")\n}","typeGuard":"func isQueryNotTracked(apiErr *model.ApiError) bool {\n    return apiErr != nil && apiErr.Typ == model.ErrorNotFound && strings.Contains(apiErr.Err.Error(), \"doesn't exist\")\n}","tryCatchPattern":"if _, apiErr := tracker.ReportQueryProgress(ctx, queryId, p); isQueryNotTracked(apiErr) {\n    // finished or wrong replica: stop reporting, don't retry blindly\n    return nil\n}","preventionTips":["Keep the queryId from ReportQueryStartForProgressTracking","Use sticky sessions in multi-replica deployments","Treat NotFound as terminal, not retryable"],"tags":["query-progress","not-found","state-mismatch","signoz"],"backgroundTag":"resource-not-found","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}