{"record":{"id":"99e69a848e49f005","repo":"crowdsecurity/crowdsec","slug":"failed-to-parse-dsn-s-w","errorCode":null,"errorMessage":"failed to parse DSN %s: %w","messagePattern":"failed to parse DSN (.+?): %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/docker/config.go","lineNumber":202,"sourceCode":"\n\t\tif !hasServiceConfig {\n\t\t\t// we set to false cause user didnt provide service configuration even though we are a swarm manager\n\t\t\td.isSwarmManager = false\n\t\t\td.logger.Warn(\"node is swarm manager, but no service configuration provided - service monitoring will be disabled, if this is unintentional please apply constraints\")\n\t\t}\n\t}\n\n\td.backoffFactory = newDockerBackOffFactory()\n\n\treturn nil\n}\n\nfunc (d *Source) ConfigureByDSN(_ context.Context, dsn string, labels map[string]string, logger *log.Entry, uuid string) error {\n\tvar err error\n\n\tparsedURL, err := url.Parse(dsn)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to parse DSN %s: %w\", dsn, err)\n\t}\n\n\tif parsedURL.Scheme != d.GetName() {\n\t\treturn fmt.Errorf(\"invalid DSN %s for docker source, must start with %s://\", dsn, d.GetName())\n\t}\n\n\td.Config = Configuration{\n\t\tFollowStdout: true,\n\t\tFollowStdErr: true,\n\t}\n\td.Config.UniqueId = uuid\n\td.Config.ContainerName = make([]string, 0)\n\td.Config.ContainerID = make([]string, 0)\n\td.runningContainerState = tracker.NewTracker[*ContainerConfig]()\n\td.runningServiceState = tracker.NewTracker[*ContainerConfig]()\n\td.Config.Mode = configuration.CAT_MODE\n\td.logger = logger\n\td.Config.Labels = labels","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/docker/config.go#L184-L220","documentation":"ConfigureByDSN parses the acquisition DSN string with url.Parse before interpreting it as a docker source. If url.Parse returns an error (malformed URL syntax), the DSN string is included and the underlying error wrapped with this prefix.","triggerScenarios":"ConfigureByDSN called with a dsn string that url.Parse rejects — e.g. stray control characters, invalid percent-encoding (`%zz`), or malformed IPv6 literal brackets.","commonSituations":"A docker:// DSN with an accidentally pasted newline or space; unescaped `%` in a query parameter; corrupted acquis.yaml entry with broken quoting.","solutions":["Inspect the DSN string for illegal URL characters and remove/escape them (use %XX encoding).","Ensure percent-encodings are valid hex (e.g. %20 not %zz).","Simplify the DSN to a known-good form: docker://<container>?<params>."],"exampleFix":"// before\nlog_path: 'docker://mycontainer?log_level=100%'\n// after\nlog_path: 'docker://mycontainer?log_level=info'","handlingStrategy":"validation","validationCode":"if _, err := url.Parse(dsn); err != nil {\n    return fmt.Errorf(\"malformed docker DSN %q: %w\", dsn, err)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Percent-encode special characters in DSN query values.","Avoid pasting DSNs with newlines/trailing spaces from docs.","Keep DSNs generated from templates simple and validate after rendering."],"tags":["url","dsn","config"],"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"}