{"record":{"id":"70ee2c733cac0e8a","repo":"crowdsecurity/crowdsec","slug":"empty-s-dsn","errorCode":null,"errorMessage":"empty %s DSN","messagePattern":"empty (.+?) DSN","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/docker/config.go","lineNumber":235,"sourceCode":"\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}\n\n\td.containerLogsOptions = &client.ContainerLogsOptions{\n\t\tShowStdout: d.Config.FollowStdout,\n\t\tShowStderr: d.Config.FollowStdErr,\n\t\tFollow:     false,\n\t}\n\n\tcontainerNameOrID := parsedURL.Host\n\n\tif containerNameOrID == \"\" {\n\t\treturn fmt.Errorf(\"empty %s DSN\", d.GetName()+\"://\")\n\t}\n\n\td.Config.ContainerName = append(d.Config.ContainerName, containerNameOrID)\n\t// we add it as an ID also so user can provide docker name or docker ID\n\td.Config.ContainerID = append(d.Config.ContainerID, containerNameOrID)\n\n\tparameters := parsedURL.Query()\n\n\tfor k, v := range parameters {\n\t\tswitch k {\n\t\tcase \"log_level\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"only one 'log_level' parameters is required, not many\")\n\t\t\t}\n\t\t\tlvl, err := log.ParseLevel(v[0])\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unknown level %s: %w\", v[0], err)\n\t\t\t}","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/docker/config.go#L217-L253","documentation":"The docker DSN must name a container: its host part is taken as container name/ID. If parsedURL.Host is empty (e.g. just `docker://`), configuration fails with this error because there is no container to attach logs from.","triggerScenarios":"ConfigureByDSN called with a DSN like `docker://` or `docker://?follow_stdout=true` where the host (container name or ID) is missing.","commonSituations":"acquis.yaml entry `log_path: docker://` with container name forgotten; templated config where the variable expanded to empty; reading container name from an unset env var.","solutions":["Add the container name or ID after the scheme: docker://mycontainer.","If the name comes from a variable, verify it is set/non-empty at config render time.","Alternatively configure via YAML with container_name/container_id lists instead of a DSN."],"exampleFix":"// before\nlog_path: 'docker://'\n// after\nlog_path: 'docker://nginx-proxy'","handlingStrategy":"validation","validationCode":"u, _ := url.Parse(dsn)\nif u != nil && u.Host == \"\" {\n    return errors.New(\"docker DSN requires a container name or ID: docker://<name>\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never leave the host part empty in a docker:// DSN.","When templating, assert the container variable is non-empty.","Prefer YAML container_name lists for config generated from variables."],"tags":["dsn","config","docker"],"backgroundTag":"missing-required-argument","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"}