{"record":{"id":"df98ae5c00074089","repo":"SigNoz/signoz","slug":"errornotfound","errorCode":"ErrorNotFound","errorMessage":"Error/Exception not found","messagePattern":"Error/Exception not found","errorType":"error_code","errorClass":"model.ApiError","httpStatus":404,"severity":"warning","filePath":"pkg/query-service/app/clickhouseReader/reader.go","lineNumber":2389,"sourceCode":"\t})\n\tvar getErrorWithSpanReponse []model.ErrorWithSpan\n\n\tquery := fmt.Sprintf(\"SELECT errorID, exceptionType, exceptionStacktrace, exceptionEscaped, exceptionMessage, timestamp, spanID, traceID, serviceName, groupID FROM %s.%s WHERE timestamp = @timestamp AND groupID = @groupID LIMIT 1\", r.TraceDB, r.errorTable)\n\targs := []interface{}{clickhouse.Named(\"groupID\", queryParams.GroupID), clickhouse.Named(\"timestamp\", strconv.FormatInt(queryParams.Timestamp.UnixNano(), 10))}\n\n\terr := r.db.Select(ctx, &getErrorWithSpanReponse, query, args...)\n\n\tr.logger.Info(query)\n\n\tif err != nil {\n\t\tr.logger.Error(\"Error in processing sql query\", errorsV2.Attr(err))\n\t\treturn nil, &model.ApiError{Typ: model.ErrorExec, Err: fmt.Errorf(\"error in processing sql query\")}\n\t}\n\n\tif len(getErrorWithSpanReponse) > 0 {\n\t\treturn &getErrorWithSpanReponse[0], nil\n\t} else {\n\t\treturn nil, &model.ApiError{Typ: model.ErrorNotFound, Err: fmt.Errorf(\"Error/Exception not found\")}\n\t}\n\n}\n\nfunc (r *ClickHouseReader) GetNextPrevErrorIDs(ctx context.Context, queryParams *model.GetErrorParams) (*model.NextPrevErrorIDs, *model.ApiError) {\n\n\tif queryParams.ErrorID == \"\" {\n\t\tr.logger.Error(\"errorId missing from params\")\n\t\treturn nil, &model.ApiError{Typ: model.ErrorBadData, Err: fmt.Errorf(\"ErrorID missing from params\")}\n\t}\n\tvar apiErr *model.ApiError\n\tgetNextPrevErrorIDsResponse := model.NextPrevErrorIDs{\n\t\tGroupID: queryParams.GroupID,\n\t}\n\tgetNextPrevErrorIDsResponse.NextErrorID, getNextPrevErrorIDsResponse.NextTimestamp, apiErr = r.getNextErrorID(ctx, queryParams)\n\tif apiErr != nil {\n\t\tr.logger.Error(\"Unable to get next error ID due to err: \", errorsV2.Attr(apiErr))\n\t\treturn nil, apiErr","sourceCodeStart":2371,"sourceCodeEnd":2407,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/clickhouseReader/reader.go#L2371-L2407","documentation":"Thrown by ClickHouseReader.GetError/GetErrorFromGroupID-style lookup when the SQL query executed successfully but returned zero rows for the requested error/exception ID or group. It is a 404-style ErrorNotFound signal from the query-service layer, meaning the error event no longer exists in the distributed_signoz_errors table (or the passed ErrorID is wrong).","triggerScenarios":"Calling the errors API (GET /api/v1/errors/{errorId} or the span-error endpoint) with an ErrorID that was purged by ClickHouse TTL, belongs to another org/tenant, or was typo'd; also when the groupID lookup finds no matching exception record.","commonSituations":"Old error events expired via TTL by the time the user clicks a link in the UI; wrong org header routing the query to another dataset; stale UI links after retention cleanup; error table migration renamed columns.","solutions":["Verify the errorID exists by querying the errors table directly in ClickHouse (SELECT count() FROM signoz_errors.distributed_signoz_errors WHERE errorID = ...)","Check the organization ID passed in the query matches the one the error was ingested under","If the error is older than your retention window, it was TTL-deleted: re-ingest or accept the 404","Treat this as a non-retryable 404 in the caller: show 'error not found' in the UI instead of retrying"],"exampleFix":"// before\nerr, apiErr := reader.GetError(ctx, params)\nif apiErr != nil { return apiErr }\n\n// after - distinguish not-found from exec failure\nerr, apiErr := reader.GetError(ctx, params)\nif apiErr != nil {\n  if apiErr.Typ == model.ErrorNotFound {\n    return &model.ApiError{Typ: model.ErrorNotFound, Err: fmt.Errorf(\"error event expired or unknown: %s\", params.ErrorID)}\n  }\n  return apiErr\n}","handlingStrategy":"validation","validationCode":"// before calling, confirm the error still exists (cheap count query or cache of recent IDs)\n// e.g. guard UI navigation links on IDs fetched in the current session\nif params.ErrorID == \"\" { return nil, errBadParam }","typeGuard":null,"tryCatchPattern":"// treat ErrorNotFound as a terminal 404 — do not retry\nif apiErr != nil && apiErr.Typ == model.ErrorNotFound {\n  http.Error(w, \"error event not found (possibly expired)\", http.StatusNotFound)\n  return\n}","preventionTips":["Pass a validated non-empty errorID","Handle 404 in UI with an 'error expired' message instead of error toasts","Respect retention windows when storing links to individual error events"],"tags":["clickhouse","not-found","errors-api","query-service","ttl-retention"],"backgroundTag":"resource-not-found","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}