crowdsecurity/crowdsec · error
%w: %w
Error message
%w: %w
What it means
The pod log streaming loop wraps line-processing failures with the errProcessLine sentinel via '%w: %w' so the retry loop can distinguish per-line errors (bad event, channel issues) from transport errors of the log stream itself.
Source
Thrown at pkg/acquisition/modules/kubernetes/run.go:220
TailLines: &tailLines,
})
fn := func() error {
if err := ctx.Err(); err != nil {
return nil
}
stream, err := req.Stream(ctx)
if err != nil {
return err
}
defer stream.Close()
sc := bufio.NewScanner(stream)
for sc.Scan() {
if err := ctx.Err(); err != nil {
return nil
}
if err := onLineFunc(sc.Text(), ns+"/"+pod+"/"+container, out); err != nil {
return fmt.Errorf("%w: %w", errProcessLine, err)
}
}
if ctx.Err() != nil {
return nil
}
return sc.Err()
}
for {
err := fn()
if err != nil {
if errors.Is(err, errProcessLine) {
return err
}
// Stream open failure or a scanner/connection error: log and retry
// below instead of giving up, to survive transient API server
// disconnects.
s.logger.Warnf("error following logs for %s/%s/%s, retrying: %s", ns, pod, container, err)
}View on GitHub (pinned to 909b515798)
Solutions
- Inspect the wrapped inner error for the actual line-processing failure
- Fix the parser/log processing that returned the inner error
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at pkg/acquisition/modules/kubernetes/run.go:220 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/c0392ab454f7d7f0.
Report an issue: GitHub.