{"record":{"id":"f488e93075bef04b","repo":"crowdsecurity/crowdsec","slug":"error-when-starting-acquisition-w","errorCode":null,"errorMessage":"error when starting acquisition: %w","messagePattern":"error when starting acquisition: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/victorialogs/run.go","lineNumber":34,"sourceCode":"// OneShotAcquisition reads a set of file and returns when done\nfunc (s *Source) OneShotAcquisition(ctx context.Context, out chan pipeline.Event, t *tomb.Tomb) error {\n\ts.logger.Debug(\"VictoriaLogs one shot acquisition\")\n\ts.Client.SetTomb(t)\n\n\treadyCtx, cancel := context.WithTimeout(ctx, s.Config.WaitForReady)\n\tdefer cancel()\n\n\terr := s.Client.Ready(readyCtx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"VictoriaLogs is not ready: %w\", err)\n\t}\n\n\tctx, cancel = context.WithCancel(ctx)\n\tdefer cancel()\n\n\trespChan, err := s.getResponseChan(ctx, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error when starting acquisition: %w\", err)\n\t}\n\n\tfor {\n\t\tselect {\n\t\tcase <-t.Dying():\n\t\t\ts.logger.Debug(\"VictoriaLogs one shot acquisition stopped\")\n\t\t\treturn nil\n\t\tcase resp, ok := <-respChan:\n\t\t\tif !ok {\n\t\t\t\ts.logger.Info(\"VictoriaLogs acquisition completed\")\n\t\t\t\treturn nil\n\t\t\t}\n\n\t\t\ts.readOneEntry(resp, s.Config.Labels, out)\n\t\t}\n\t}\n}\n","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/victorialogs/run.go#L16-L52","documentation":"One-shot acquisition failed to obtain its log channel: the wrapped error comes from `getResponseChan`, i.e. from `Client.Tail` (in TAIL_MODE) when starting the tail request, or the query machinery in range mode. It is a wrapper around the lower-level transport/HTTP failure.","triggerScenarios":"`s.getResponseChan(ctx, false)` returns an error — in tail mode a transport failure or exhausted-retry HTTP error from `Client.Tail`; anything the tail client surfaces, such as connection refused or a 4xx/5xx after retries.","commonSituations":"`cscli` one-shot read configured with `mode: tail` against an unreachable or rejecting VictoriaLogs; transient network outage during a backfill run; bad query rejected by the server.","solutions":["Look at the wrapped cause beneath this message — fix that root error first (connectivity, query, auth).","If one-shot mode should be a fixed historical read, don't use `mode: tail`; use the default query mode so `QueryRange` is used.","Confirm VictoriaLogs health and URL before running one-shot acquisition.","Retry after transient network issues; the error occurs at startup, not mid-stream.","Validate the LogsQL `query` against the server directly."],"exampleFix":"// before (acquis.yaml)\nmode: tail\n// after\n# omit 'mode' (default query range) for one-shot backfills:\n# mode: query\n","handlingStrategy":"try-catch","validationCode":"// pre-flight: health + reachability\nif err := probe(cfg.URL); err != nil { return err }","typeGuard":null,"tryCatchPattern":"if err := oneShot(ctx); err != nil {\n    var tailErr *vlclient.TailError\n    if errors.As(err, &tailErr) { /* fix connectivity/query per wrapped cause */ }\n    return err\n}","preventionTips":["Run one-shot acquisition only after confirming server health","Avoid tail mode for historical backfills","Log and inspect the wrapped root error, not the wrapper","Validate query syntax before the run"],"tags":["victorialogs","acquisition","startup"],"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-14T05:17:10.506Z"}