{"record":{"id":"3d88ebfb1c9310a7","repo":"crowdsecurity/crowdsec","slug":"invalid-dsn-s-for-file-source-must-start-with-fi","errorCode":null,"errorMessage":"invalid DSN %s for file source, must start with file://","messagePattern":"invalid DSN (.+?) for file source, must start with file://","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/file/config.go","lineNumber":153,"sourceCode":"\t\t\t\t\t}\n\n\t\t\t\t\ts.watchedDirectories[directory] = true\n\t\t\t\t} else {\n\t\t\t\t\ts.logger.Debugf(\"Watch for directory %s already exists\", directory)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\ts.logger.Infof(\"Adding file %s to datasources\", file)\n\t\t\ts.files = append(s.files, file)\n\t\t}\n\t}\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\tif !strings.HasPrefix(dsn, \"file://\") {\n\t\treturn fmt.Errorf(\"invalid DSN %s for file source, must start with file://\", dsn)\n\t}\n\n\ts.logger = logger\n\ts.config = Configuration{}\n\n\tdsn = strings.TrimPrefix(dsn, \"file://\")\n\n\targs := strings.Split(dsn, \"?\")\n\n\tif args[0] == \"\" {\n\t\treturn errors.New(\"empty file:// DSN\")\n\t}\n\n\tif len(args) == 2 && args[1] != \"\" {\n\t\tparams, err := url.ParseQuery(args[1])\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not parse file args: %w\", err)\n\t\t}","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/file/config.go#L135-L171","documentation":"Returned by the file source's ConfigureByDSN when the DSN passed to crowdsec doesn't start with the required file:// scheme — the file acquisition module cannot interpret the DSN (e.g. it was routed to the wrong module or the scheme is misspelled).","triggerScenarios":"Thrown at pkg/acquisition/modules/file/config.go:153 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a DSN of the form file:///var/log/foo.log","Add the file:// prefix to the source's filename in the acquisition config"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}