{"record":{"id":"a1de7997321a1bc9","repo":"stamparm/maltrail","slug":"invalid-configuration-line-line","errorCode":null,"errorMessage":"invalid configuration (line: '{line}')","messagePattern":"invalid configuration \\(line: '(.+?)'\\)","errorType":"validation","errorClass":"ConfigError","httpStatus":null,"severity":"error","filePath":"sensor/src/config.rs","lineNumber":443,"sourceCode":"            Some(idx) => {\n                let mut cut = idx;\n                while cut > 0 && line.as_bytes()[cut - 1].is_ascii_whitespace() {\n                    cut -= 1;\n                }\n                &line[..cut]\n            }\n            None => line,\n        };\n        if line.trim().is_empty() {\n            continue;\n        }\n\n        if !line.contains(' ') {\n            if line.bytes().any(|c| !(c.is_ascii_alphanumeric() || c == b'_')) {\n                if array.as_deref() == Some(\"USERS\") {\n                    bail!(\"invalid USERS entry '{line}'\\n[?] (hint: add whitespace at start of line)\");\n                }\n                bail!(\"invalid configuration (line: '{line}')\");\n            }\n            let name = line.to_ascii_uppercase();\n            out.insert(name.clone(), Value::Array(Vec::new()));\n            array = Some(name);\n            continue;\n        }\n\n        if let Some(arr) = array.clone() {\n            if line.starts_with(' ') {\n                let entry = line.trim().to_string();\n                if let Some(Value::Array(items)) = out.get_mut(&arr) {\n                    // IP_ALIASES is a server-side option, parsed here only so the sensor does\n                    // not reject a shared configuration file. Its address part is not expanded.\n                    items.push(entry);\n                }\n                continue;\n            }\n        }","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/stamparm/maltrail/blob/77cfb06d7606506d101bbcec0786c77166c4255e/sensor/src/config.rs#L425-L461","documentation":"parse_raw rejects any whitespace-less line containing characters outside [A-Za-z0-9_]. Such a line can't be a valid scalar/array entry or a section/array name, so the parser bails with the offending line. This is the generic sibling of the USERS-specific message: any malformed token-like line in the config triggers it.","triggerScenarios":"A config line with no space character that contains any byte that is not ASCII alphanumeric or '_' — e.g. a stray 'admin:pass', punctuation, or an accidentally pasted command — while parsing the sensor config (called from load and its tests).","commonSituations":"Typo merging a key and value without a space (`DEBUG=true` style instead of space-separated); comment markers or symbols on a flush-left line; copy-paste artifacts; editing configs on Windows with a stray character.","solutions":["Find the quoted line in your config and fix it to the expected format (space-separated key/value or plain alphanumeric name)","Add a space between key and value if you wrote them glued together","Remove or comment out stray punctuation/symbols on flush-left lines","Diff against a known-good sensor.conf to spot the malformed line"],"exampleFix":"// before (config)\nDEBUG=true\n// after\nDEBUG true","handlingStrategy":"validation","validationCode":"import re\nfor i, line in enumerate(open(\"sensor.conf\")):\n    s = line.rstrip(\"\\n\")\n    if s and ' ' not in s and not re.fullmatch(r'[A-Za-z0-9_]*', s):\n        print(f\"invalid token-like line {i+1}: {s!r}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep key/value separated by a space in this config format","Diff configs against a known-good example after edits","Strip copy-paste artifacts before committing config changes"],"tags":["rust","configuration","parsing"],"backgroundTag":"invalid-config-value","analyzedSha":"77cfb06d7606506d101bbcec0786c77166c4255e","analyzedAt":"2026-09-13T03:50:16.010Z","contentChangedAt":"2026-09-13T03:50:16.010Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}