{"record":{"id":"9aeeb2139c12eeff","repo":"crowdsecurity/crowdsec","slug":"while-parsing-dsn-s-w-9aeeb2","errorCode":null,"errorMessage":"while parsing dsn '%s': %w","messagePattern":"while parsing dsn '(.+?)': %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/victorialogs/config.go","lineNumber":126,"sourceCode":"\t\tFailMaxDuration: s.Config.MaxFailureDuration,\n\t}\n\n\ts.Client = vlclient.NewVLClient(clientConfig)\n\ts.Client.Logger = logger.WithFields(log.Fields{\"component\": \"victorialogs-client\", \"source\": s.Config.URL})\n\n\treturn nil\n}\n\nfunc (s *Source) ConfigureByDSN(_ context.Context, dsn string, labels map[string]string, logger *log.Entry, uuid string) error {\n\ts.logger = logger\n\ts.Config = Configuration{}\n\ts.Config.Mode = configuration.CAT_MODE\n\ts.Config.Labels = labels\n\ts.Config.UniqueId = uuid\n\n\tu, err := url.Parse(dsn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"while parsing dsn '%s': %w\", dsn, err)\n\t}\n\n\tif u.Scheme != \"victorialogs\" {\n\t\treturn fmt.Errorf(\"invalid DSN %s for VictoriaLogs source, must start with victorialogs://\", dsn)\n\t}\n\n\tif u.Host == \"\" {\n\t\treturn errors.New(\"empty host\")\n\t}\n\n\tscheme := \"http\"\n\n\tparams := u.Query()\n\n\tif q := params.Get(\"ssl\"); q != \"\" {\n\t\tscheme = \"https\"\n\t}\n","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/victorialogs/config.go#L108-L144","documentation":"ConfigureByDSN failed when url.Parse could not interpret the DSN string. The DSN passed via -type victorialogs acquisition (e.g. on cscli or acquis DSN) is not a parseable URL, so the source cannot derive its configuration.","triggerScenarios":"A DSN string like 'victorialogs://host:port' contains characters illegal in a URL (unescaped spaces, stray '%', control chars) making url.Parse return an error.","commonSituations":"Pasting a DSN with a trailing space or newline from a shell/docs; unescaped special characters in a password or query embedded in the DSN; quoting mistakes in acquis.yaml leaving raw '%' sequences.","solutions":["Inspect the wrapped url.Parse error to find the offending character and escape or remove it (e.g. use %20 for spaces).","Rewrite the DSN in the standard form victorialogs://host:port with proper URL escaping.","Quote the DSN in YAML and check for stray whitespace or line breaks introduced by copy-paste."],"exampleFix":"// before\nvictorialogs://vl host:9428  # space breaks url.Parse\n\n// after\nvictorialogs://vl-host:9428","handlingStrategy":"validation","validationCode":"if _, err := url.Parse(dsn); err != nil {\n    return fmt.Errorf(\"malformed DSN %q: %w\", dsn, err)\n}","typeGuard":null,"tryCatchPattern":"u, err := url.Parse(dsn)\nif err != nil {\n    log.Errorf(\"bad DSN %q: %v\", dsn, err)\n    return err\n}","preventionTips":["URL-escape special characters when composing DSNs.","Trim whitespace/newlines from DSN strings sourced from shell or docs.","Quote DSNs in YAML files."],"tags":["config","url","victorialogs","dsn"],"backgroundTag":"invalid-url-format","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"}