crowdsecurity/crowdsec · error

VictoriaLogs is not ready: %w

Error message

VictoriaLogs is not ready: %w

What it means

During one-shot acquisition, the client polls VictoriaLogs' health endpoint every 500ms until the `WaitForReady` timeout elapses. If the server never answers 200/healthy in that window, `Ready` returns the timeout or last error, and CrowdSec aborts the acquisition run.

Source

Thrown at pkg/acquisition/modules/victorialogs/run.go:26

	"gopkg.in/tomb.v2"

	"github.com/crowdsecurity/crowdsec/pkg/acquisition/configuration"
	"github.com/crowdsecurity/crowdsec/pkg/acquisition/modules/victorialogs/internal/vlclient"
	"github.com/crowdsecurity/crowdsec/pkg/metrics"
	"github.com/crowdsecurity/crowdsec/pkg/pipeline"
)

// OneShotAcquisition reads a set of file and returns when done
func (s *Source) OneShotAcquisition(ctx context.Context, out chan pipeline.Event, t *tomb.Tomb) error {
	s.logger.Debug("VictoriaLogs one shot acquisition")
	s.Client.SetTomb(t)

	readyCtx, cancel := context.WithTimeout(ctx, s.Config.WaitForReady)
	defer cancel()

	err := s.Client.Ready(readyCtx)
	if err != nil {
		return fmt.Errorf("VictoriaLogs is not ready: %w", err)
	}

	ctx, cancel = context.WithCancel(ctx)
	defer cancel()

	respChan, err := s.getResponseChan(ctx, false)
	if err != nil {
		return fmt.Errorf("error when starting acquisition: %w", err)
	}

	for {
		select {
		case <-t.Dying():
			s.logger.Debug("VictoriaLogs one shot acquisition stopped")
			return nil
		case resp, ok := <-respChan:
			if !ok {
				s.logger.Info("VictoriaLogs acquisition completed")

View on GitHub (pinned to 909b515798)

Solutions

  1. Start/verify VictoriaLogs and confirm `curl '<url>/health'` returns 200.
  2. Increase the `wait_for_ready` (WaitForReady) duration in the acquisition config.
  3. Fix the `url`/`prefix` in the config if health checks go to the wrong host/port.
  4. Check VictoriaLogs logs for slow startup (index replay, disk pressure) and free resources.
  5. If intentionally stopping acquisition, the wrapped `context.Canceled` is benign — ignore.

Example fix

# before
source: victorialogs
wait_for_ready: 5s
# after
source: victorialogs
wait_for_ready: 2m  # allow slow first-start VictoriaLogs to become healthy
Defensive patterns

Strategy: validation

Validate before calling

// before one-shot acquisition
client := http.Client{Timeout: 5 * time.Second}
resp, err := client.Get(cfg.URL + "/health")
if err != nil || resp.StatusCode != 200 {
    return fmt.Errorf("VictoriaLogs not ready at %s", cfg.URL)
}

Try / catch

if err := acquire(ctx); err != nil {
    if errors.Is(err, context.DeadlineExceeded) {
        // readiness timeout: retry later with a larger WaitForReady
    }
}

Prevention

When it happens

Trigger: `s.Client.Ready(readyCtx)` fails because the `WaitForReady` duration (config) expires before VictoriaLogs answers health checks with HTTP 200: server down, wrong URL, slow startup, or context canceled because the parent run is dying.

Common situations: Running `cscli` one-shot acquire against a VictoriaLogs instance that is still starting; wrong `url:` in acquis config; VictoriaLogs resource-starved and slow to become healthy; `wait_for_ready` left at a small default while the server takes minutes to boot on first start.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/9ede2930998075da. Report an issue: GitHub.