{"record":{"id":"782808373c1dcc3f","repo":"SigNoz/signoz","slug":"start-time-is-required-for-search-queries","errorCode":null,"errorMessage":"start time is required for search queries","messagePattern":"start time is required for search queries","errorType":"exception","errorClass":"error","httpStatus":400,"severity":"error","filePath":"pkg/query-service/app/clickhouseReader/reader.go","lineNumber":120,"sourceCode":"\tsignozTSTableNameV4Reduced = \"distributed_time_series_v4_reduced\"\n\n\tsignozTableAttributesMetadata      = \"distributed_attributes_metadata\"\n\tsignozLocalTableAttributesMetadata = \"attributes_metadata\"\n\n\tsignozUpdatedMetricsMetadataLocalTable = \"updated_metadata\"\n\tsignozUpdatedMetricsMetadataTable      = \"distributed_updated_metadata\"\n\tminTimespanForProgressiveSearch        = time.Hour\n\tminTimespanForProgressiveSearchMargin  = time.Minute\n\tmaxProgressiveSteps                    = 4\n\tcharset                                = \"abcdefghijklmnopqrstuvwxyz\" +\n\t\t\"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\"\n\tNANOSECOND = 1000000000\n)\n\nvar (\n\tErrNoOperationsTable            = errors.New(\"no operations table supplied\")\n\tErrNoIndexTable                 = errors.New(\"no index table supplied\")\n\tErrStartTimeRequired            = errors.New(\"start time is required for search queries\")\n\tseededRand           *rand.Rand = rand.New(\n\t\trand.NewSource(time.Now().UnixNano()))\n)\n\n// SpanWriter for reading spans from ClickHouse\ntype ClickHouseReader struct {\n\tdb                      clickhouse.Conn\n\tprometheus              prometheus.Prometheus\n\tsqlDB                   sqlstore.SQLStore\n\tTraceDB                 string\n\toperationsTable         string\n\tdurationTable           string\n\tindexTable              string\n\terrorTable              string\n\tusageExplorerTable      string\n\tSpansTable              string\n\tspanAttributeTableV2    string\n\tspanAttributesKeysTable string","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/SigNoz/signoz/blob/5069bf80b08f1f00d7e014eccc09902f9871004f/pkg/query-service/app/clickhouseReader/reader.go#L102-L138","documentation":"ErrStartTimeRequired is a sentinel error enforcing that search queries against ClickHouse must include a start time; without it, unbounded scans would be run.","triggerScenarios":"Calling reader search methods (span/trace search helpers) with params whose StartTimestamp/start is zero/empty; parse helpers propagate it from missing start/end params in the HTTP query.","commonSituations":"Clients omitting the startTimestamp query parameter; dashboards with relative-time variables that evaluate to empty; API scripts copying examples without time params.","solutions":["Add start (and typically end) timestamp parameters to the query string (Unix microseconds)","Default the dashboard/client to a relative window like now-1h when no start is set","Validate params client-side before calling the search API"],"exampleFix":"// before\nGET /api/v1/search?query=error\n// after\nGET /api/v1/search?query=error&startTimestamp=1750000000000000&endTimestamp=1750003600000000","handlingStrategy":"validation","validationCode":"if params.StartTimestamp == 0 {\n    params.StartTimestamp = time.Now().Add(-time.Hour).UnixMicro()\n}","typeGuard":null,"tryCatchPattern":"err := reader.Search(ctx, params)\nif errors.Is(err, clickhouseReader.ErrStartTimeRequired) {\n    params.Start = defaultStart(); err = reader.Search(ctx, params)\n}","preventionTips":["Always default dashboards to a relative time window","Validate time params in client helpers before calling"],"tags":["validation","query-service","search","missing-param"],"backgroundTag":"missing-required-parameter","analyzedSha":"5069bf80b08f1f00d7e014eccc09902f9871004f","analyzedAt":"2026-08-28T06:22:12.824Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}