crowdsecurity/crowdsec · error
empty host
Error message
empty host
What it means
When a VictoriaLogs datasource is configured via DSN string (victorialogs://...), ConfigureByDSN parses it as a URL and requires a host portion identifying the VictoriaLogs server. A DSN like 'victorialogs://' with no host returns 'empty host'.
Source
Thrown at pkg/acquisition/modules/victorialogs/config.go:134
func (s *Source) ConfigureByDSN(_ context.Context, dsn string, labels map[string]string, logger *log.Entry, uuid string) error {
s.logger = logger
s.Config = Configuration{}
s.Config.Mode = configuration.CAT_MODE
s.Config.Labels = labels
s.Config.UniqueId = uuid
u, err := url.Parse(dsn)
if err != nil {
return fmt.Errorf("while parsing dsn '%s': %w", dsn, err)
}
if u.Scheme != "victorialogs" {
return fmt.Errorf("invalid DSN %s for VictoriaLogs source, must start with victorialogs://", dsn)
}
if u.Host == "" {
return errors.New("empty host")
}
scheme := "http"
params := u.Query()
if q := params.Get("ssl"); q != "" {
scheme = "https"
}
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 errView on GitHub (pinned to 909b515798)
Solutions
- Add the host to the DSN: victorialogs://victorialogs:9428
- Include the full address with port if non-default
- If config is generated, check the template renders the host variable
Example fix
// before source: victorialogs:// // after source: victorialogs://victorialogs:9428
Defensive patterns
Strategy: validation
Validate before calling
// validate DSN shape before use
u, err := url.Parse(dsn)
if err != nil || u.Scheme != "victorialogs" || u.Host == "" { return errors.New("DSN must be victorialogs://host[:port]") } Prevention
- Copy full DSN examples including host and port from docs
- Check that generated configs render host variables
- Test DSN parsing with cscli/starting crowdsec before restart
When it happens
Trigger: DSN of the form 'victorialogs://' or 'victorialogs:///path' with no authority component in the acquisition config's 'source:' field.
Common situations: Incomplete DSN left in acquis.d/config after copying docs; host removed when templating; missing scheme+host because the user pasted only the path.
Understand the failure class
Background: "Invalid URL" / "URL cannot be empty": fix the malformed or missing URL behind request-construction failures — this error's family across 50 libraries.
Related errors
- VictoriaLogs url is mandatory
- VictoriaLogs query is mandatory
- invalid DSN %s for journalctl source, must start with journa
- unsupported key %s in journalctl DSN
- unknown parameter %s
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/72f364a95f071c96.
Report an issue: GitHub.