{"record":{"id":"d966d568b0a3f98d","repo":"stamparm/maltrail","slug":"invalid-users-entry-line-hint-add-whitespace-at-start-of","errorCode":null,"errorMessage":"invalid USERS entry '{line}'\n[?] (hint: add whitespace at start of line)","messagePattern":"invalid USERS entry '(.+?)'\n\\[\\?\\] \\(hint: add whitespace at start of line\\)","errorType":"validation","errorClass":"ConfigError","httpStatus":null,"severity":"error","filePath":"sensor/src/config.rs","lineNumber":441,"sourceCode":"        // re.sub(r\"\\s*#.*\", \"\", line)\n        let line = match line.find('#') {\n            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;","sourceCodeStart":423,"sourceCodeEnd":459,"githubUrl":"https://github.com/stamparm/maltrail/blob/77cfb06d7606506d101bbcec0786c77166c4255e/sensor/src/config.rs#L423-L459","documentation":"The sensor's config parser (parse_raw) rejects a whitespace-less line inside a USERS array that contains characters other than alphanumerics or underscore. Because USERS entries like admin: secret would contain ':' with no space separator, this is almost certainly a malformed USERS block — and the parser helpfully suggests the likely cause: the line is missing its leading whitespace, so it isn't being treated as an array entry at all.","triggerScenarios":"Loading the sensor config when a line under [USERS]-style array context has no space, contains non-[A-Za-z0-9_] characters (like ':' in user:pass), and the current array being parsed is USERS — typically the entry lost its indentation.","commonSituations":"Writing `admin: secret` flush-left inside a USERS block instead of indented; copy-pasting entries from docs without indentation; converting an old config format where entries had different syntax.","solutions":["Indent the USERS entry so the parser treats it as an array element (add whitespace at the start of the line)","Ensure each entry has the expected separator with spacing (e.g. `admin secret`) rather than flush-left `admin:secret`","Check the line directly above: an unindented line ends the current array context","Re-run the sensor after fixing; the same check covers other arrays with the generic message"],"exampleFix":"// before (config)\nUSERS\nadmin: secret\n// after\nUSERS\n    admin secret","handlingStrategy":"validation","validationCode":"import re\nfor i, line in enumerate(open(\"sensor.conf\")):\n    stripped = line.rstrip(\"\\n\")\n    if 'USERS' in stripped or (stripped and not stripped[0].isspace()):\n        continue\n    if stripped.strip() and not re.fullmatch(r'[A-Za-z0-9_ ]+', stripped.strip()):\n        print(f\"check line {i+1}: {stripped!r}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always indent entries inside USERS blocks","Use space-separated user entries, not colon-joined","Validate the config by loading it once in CI"],"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"}