crowdsecurity/crowdsec · error
invalid since in dsn: %w
Error message
invalid since in dsn: %w
What it means
ConfigureByDSN parses DSN parameters for the VictoriaLogs acquisition source. The `since` parameter must be a valid Go duration string (e.g. "5m", "1h"); when time.ParseDuration fails to parse the provided value, the error is wrapped with "invalid since in dsn" and configuration is aborted.
Source
Thrown at pkg/acquisition/modules/victorialogs/config.go:161
}
if q := params.Get("query"); q != "" {
s.Config.Query = q
}
if w := params.Get("wait_for_ready"); w != "" {
s.Config.WaitForReady, err = time.ParseDuration(w)
if err != nil {
return err
}
} else {
s.Config.WaitForReady = 10 * time.Second
}
if since := params.Get("since"); since != "" {
s.Config.Since, err = time.ParseDuration(since)
if err != nil {
return fmt.Errorf("invalid since in dsn: %w", err)
}
}
if maxFailureDuration := params.Get("max_failure_duration"); maxFailureDuration != "" {
duration, err := time.ParseDuration(maxFailureDuration)
if err != nil {
return fmt.Errorf("invalid max_failure_duration in dsn: %w", err)
}
s.Config.MaxFailureDuration = duration
} else {
s.Config.MaxFailureDuration = 5 * time.Second // for OneShot mode it doesn't make sense to have longer duration
}
if limit := params.Get("limit"); limit != "" {
limit, err := strconv.Atoi(limit)
if err != nil {
return fmt.Errorf("invalid limit in dsn: %w", err)View on GitHub (pinned to 909b515798)
Solutions
- Fix the `since` value in the DSN/acquis.yaml to a valid Go duration, e.g. `since=1h`
- Remember valid units are ns, us, ms, s, m, h — days/weeks are not supported; convert manually (e.g. 1d -> 24h)
- Check the wrapped error message for the exact position where parsing failed
- Omit the `since` parameter entirely to use the default
Example fix
// before url: victorialogs+http://127.0.0.1:8428?since=24h // after url: victorialogs+http://127.0.0.1:8428?since=24h0m0s # or a valid unit like 1h
Defensive patterns
Strategy: validation
Validate before calling
const dsn = "victorialogs+http://127.0.0.1:8428?since=1h"
const p = new URL(dsn.slice("victorialogs+".length))
const since = p.searchParams.get("since")
if (since && !/^-?\d+(ns|us|ms|s|m|h)([\d.]+(ns|us|ms|s|m|h))*$/.test(since)) {
throw new Error(`invalid since duration: ${since}`)
} Prevention
- Always include a unit suffix in duration values (1h, 30m, 90s)
- Convert days/weeks to hours manually — Go durations lack d/w units
- Run config validation (cscli) before starting the service
When it happens
Trigger: Calling ConfigureByDSN (or cscli/crowdsec loading the acquis.yaml DSN) with a `since=` URL parameter that is not a parseable duration, e.g. `since=yesterday`, `since=24h`, `since=3600` (missing unit).
Common situations: Typo in the duration unit, copying a Unix timestamp or human phrase into `since`, or setting `since` in a config file without realizing Go duration syntax requires a unit suffix.
Understand the failure class
Background: "invalid duration" / "failed to parse duration": why your timeout, interval, or TTL string is rejected and which formats each library accepts — this error's family across 32 libraries.
Related errors
- invalid max_failure_duration in dsn: %w
- cannot parse VictoriaLogs acquisition configuration: %s
- while parsing dsn '%s': %w
- invalid DSN %s for VictoriaLogs source, must start with vict
- invalid limit in dsn: %w
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/0f48deafd14712e4.
Report an issue: GitHub.