{"record":{"id":"9bd1ea9e0d56e7ab","repo":"crowdsecurity/crowdsec","slug":"could-not-parse-file-args-w","errorCode":null,"errorMessage":"could not parse file args: %w","messagePattern":"could not parse file args: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/file/config.go","lineNumber":170,"sourceCode":"\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}\n\n\t\tfor key, value := range params {\n\t\t\tswitch key {\n\t\t\tcase \"log_level\":\n\t\t\t\tif len(value) != 1 {\n\t\t\t\t\treturn errors.New(\"expected zero or one value for 'log_level'\")\n\t\t\t\t}\n\n\t\t\t\tlvl, err := log.ParseLevel(value[0])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"unknown level %s: %w\", value[0], err)\n\t\t\t\t}\n\n\t\t\t\ts.logger.Logger.SetLevel(lvl)\n\t\t\tcase \"max_buffer_size\":\n\t\t\t\tif len(value) != 1 {\n\t\t\t\t\treturn errors.New(\"expected zero or one value for 'max_buffer_size'\")","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/file/config.go#L152-L188","documentation":"Returned by ConfigureByDSN when the query-string portion of a file:// DSN (everything after '?') is not a valid URL-encoded query. Wraps the net/url parse error; the offending input is the raw query parameters supplied in the DSN.","triggerScenarios":"Thrown at pkg/acquisition/modules/file/config.go:170 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the DSN query parameters to well-formed key=value pairs separated by '&'","URL-encode special characters in parameter values"],"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-14T00:17:10.932Z"}