{"record":{"id":"bf30b57124b3f9ec","repo":"crowdsecurity/crowdsec","slug":"querying-range-w-bf30b5","errorCode":null,"errorMessage":"querying range: %w","messagePattern":"querying range: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/victorialogs/internal/vlclient/vl_client.go","lineNumber":127,"sourceCode":"}\n\nfunc (lc *VLClient) doQueryRange(ctx context.Context, uri string, c chan *Log, infinite bool) error {\n\tlc.currentTickerInterval = 100 * time.Millisecond\n\tticker := time.NewTicker(lc.currentTickerInterval)\n\n\tdefer ticker.Stop()\n\n\tfor {\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tcase <-lc.t.Dying():\n\t\t\treturn lc.t.Err()\n\t\tcase <-ticker.C:\n\t\t\tresp, err := lc.Get(ctx, uri)\n\t\t\tif err != nil {\n\t\t\t\tif ok := lc.shouldRetry(); !ok {\n\t\t\t\t\treturn fmt.Errorf(\"querying range: %w\", err)\n\t\t\t\t}\n\n\t\t\t\tlc.increaseTicker(ticker)\n\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\tif resp.StatusCode != http.StatusOK {\n\t\t\t\tlc.Logger.Warnf(\"bad HTTP response code for query range: %d\", resp.StatusCode)\n\t\t\t\tbody, _ := io.ReadAll(resp.Body)\n\t\t\t\tresp.Body.Close()\n\n\t\t\t\tif ok := lc.shouldRetry(); !ok {\n\t\t\t\t\treturn fmt.Errorf(\"bad HTTP response code: %d: %s: %w\", resp.StatusCode, string(body), err)\n\t\t\t\t}\n\n\t\t\t\tlc.increaseTicker(ticker)\n","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/victorialogs/internal/vlclient/vl_client.go#L109-L145","documentation":"doQueryRange polls VictoriaLogs on a ticker; when lc.Get fails it consults shouldRetry and, if retries are exhausted (or not allowed), returns the underlying HTTP error wrapped with \"querying range\". This means the acquisition client could not perform the query_range HTTP request at all.","triggerScenarios":"lc.Get returns an error (connection refused, DNS failure, TLS error, request creation failure) and lc.shouldRetry() returns false — i.e. the retry budget for MaxFailureDuration is exhausted.","commonSituations":"VictoriaLogs is down or unreachable at the configured host:port, firewall blocks the port, service restarting during a long outage exceeding max_failure_duration, or bad TLS configuration.","solutions":["Verify VictoriaLogs is reachable: curl the configured URL from the crowdsec host","Check host/port in the DSN and any proxy/firewall rules","Inspect the wrapped inner error for the root cause (refused vs timeout vs TLS)","Increase max_failure_duration in the DSN if the outage window is legitimately long"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check connectivity\nconst res = await fetch(baseURL + \"/health\").catch(() => null)\nif (!res) throw new Error(\"VictoriaLogs unreachable before starting acquisition\")","typeGuard":null,"tryCatchPattern":"try {\n  await runAcquisition()\n} catch (e) {\n  if (String(e).startsWith(\"querying range\") && /connection refused|no such host/.test(e.cause ?? \"\")) {\n    scheduleReconnectWithBackoff()\n  } else {\n    throw e\n  }\n}","preventionTips":["Monitor VictoriaLogs health endpoint before and during acquisition","Set a generous max_failure_duration for expected maintenance windows","Check firewall/DNS from the crowdsec host specifically"],"tags":["network","http","victorialogs"],"backgroundTag":"api-request-failed","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}