{"record":{"id":"9bd9c4699a33756d","repo":"crowdsecurity/crowdsec","slug":"invalid-dsn-s-for-docker-source-must-start-with","errorCode":null,"errorMessage":"invalid DSN %s for docker source, must start with %s://","messagePattern":"invalid DSN (.+?) for docker source, must start with (.+?)://","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/docker/config.go","lineNumber":206,"sourceCode":"\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\n\n\topts := []client.Opt{\n\t\tclient.FromEnv,\n\t}","sourceCodeStart":188,"sourceCodeEnd":224,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/docker/config.go#L188-L224","documentation":"ConfigureByDSN checks that the DSN's URL scheme equals the docker source name (\"docker\"). A DSN whose parsed scheme differs is rejected because it was handed to the wrong source type — usually a misconfigured acquisition entry or a dispatch bug.","triggerScenarios":"ConfigureByDSN receiving a dsn whose url.Parse(...).Scheme != \"docker\", e.g. `docker ://x` with a space, `Docker://x` (case), or a journald/file DSN routed to the docker source.","commonSituations":"Typo in acquis.yaml `log_path` (space after the scheme or uppercase name); programmatic source selection matching the wrong module; copy-paste between source configs.","solutions":["Rewrite the DSN so it starts exactly with `docker://` (lowercase, no space).","Check the acquisition config line for typos or stray characters around the scheme.","If the DSN belongs to another source type, move it to the correct source block."],"exampleFix":"// before\nlog_path: 'Docker ://mycontainer'\n// after\nlog_path: 'docker://mycontainer'","handlingStrategy":"validation","validationCode":"u, err := url.Parse(dsn)\nif err == nil && u.Scheme != \"docker\" {\n    return fmt.Errorf(\"DSN scheme %q is not docker://\", u.Scheme)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write the scheme lowercase with no space: docker://.","Match acquisition source blocks to the DSN scheme they expect.","Lint acquis.yaml entries with a regex like ^[a-z]+:// before shipping."],"tags":["dsn","config","url-scheme"],"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-14T00:17:10.932Z"}