{"record":{"id":"dee1c80a7210ba45","repo":"stamparm/maltrail","slug":"no-maltrail-sensor-package-entry-found-in-s","errorCode":null,"errorMessage":"[!] no maltrail-sensor package entry found in %s","messagePattern":"\\[!\\] no maltrail-sensor package entry found in (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"sensor/tools/check_version.py","lineNumber":99,"sourceCode":"    built. A version bump is text; verifying it should be text too.\n    \"\"\"\n\n    match = re.search(r'^pub const VERSION: &str = \"([^\"]+)\";', _read(SETTINGS_GEN), re.M)\n    if not match:\n        raise SystemExit(\"[!] no VERSION constant found in %s\" % SETTINGS_GEN)\n    return match.group(1)\n\n\ndef cargo_lock_version():\n    \"\"\"The maltrail-sensor entry in sensor/Cargo.lock.\n\n    A FIFTH place, and the release builds with --locked: a lock that still names the old version\n    does not warn, it refuses to build.\n    \"\"\"\n\n    match = re.search(r'name = \"maltrail-sensor\"\\nversion = \"([^\"]+)\"', _read(CARGO_LOCK))\n    if not match:\n        raise SystemExit(\"[!] no maltrail-sensor package entry found in %s\" % CARGO_LOCK)\n    return match.group(1)\n\n\ndef series(version):\n    \"\"\"'3.0.1' and '3.0' both reduce to (3, 0) - Maltrail versions two components, Cargo three.\n\n    A SemVer pre-release / build suffix is stripped first, so 'v3.0-rc1' and '3.0.0+deb' are the\n    3.0 series like anything else. Release candidates are the whole point of having a release\n    pipeline that can be rehearsed, and refusing to name one would have made that impossible.\n    \"\"\"\n    version = re.split(r\"[-+]\", version, 1)[0]\n    parts = version.split('.')\n    if len(parts) < 2:\n        raise SystemExit(\"[!] version %r is not 'major.minor[.patch]'\" % version)\n    try:\n        return (int(parts[0]), int(parts[1]))\n    except ValueError:\n        raise SystemExit(\"[!] version %r has non-numeric components\" % version)","sourceCodeStart":81,"sourceCodeEnd":117,"githubUrl":"https://github.com/stamparm/maltrail/blob/77cfb06d7606506d101bbcec0786c77166c4255e/sensor/tools/check_version.py#L81-L117","documentation":"cargo_lock_version scans sensor/Cargo.lock for the `name = \"maltrail-sensor\"` package entry and its adjacent version line. If the lockfile has no such entry (stale lockfile, renamed package, or lockfile not regenerated after Cargo.toml changes), the tool exits with this message. This matters because release builds run with --locked, where an outdated lock would otherwise fail later and opaquely.","triggerScenarios":"Running check_version.py when Cargo.lock does not contain a [[package]] block with `name = \"maltrail-sensor\"` followed by `version = \"...\"` — e.g. the package was renamed in Cargo.toml, the lockfile was deleted/regenerated before the rename, or the lockfile predates the package.","commonSituations":"Renaming the crate during a refactor without regenerating Cargo.lock; checking out a branch where Cargo.lock is stale or missing the sensor entry; reverting Cargo.toml but not Cargo.lock (or vice versa).","solutions":["Run `cargo update --manifest-path sensor/Cargo.toml` (or `cargo generate-lockfile`) to regenerate Cargo.lock with the maltrail-sensor entry","Confirm [package] name in sensor/Cargo.toml is exactly `maltrail-sensor` (lock entries must match)","Ensure the [[package]] block has name and version on consecutive lines in the expected order","Re-run check_version.py after the lockfile is refreshed"],"exampleFix":"// before (Cargo.lock missing entry)\n[[package]]\nname = \"some-other-crate\"\n// after\n[[package]]\nname = \"maltrail-sensor\"\nversion = \"3.2.1\"","handlingStrategy":"validation","validationCode":"import re, pathlib\ntext = pathlib.Path(\"sensor/Cargo.lock\").read_text()\nassert re.search(r'name = \"maltrail-sensor\"\\nversion = \"([^\"]+)\"', text), \"Cargo.lock missing maltrail-sensor entry\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run cargo update after any Cargo.toml name/version change","Commit Cargo.lock together with Cargo.toml changes","Grep the lockfile in CI before release gates"],"tags":["python","rust","cargo-lock","release-tooling"],"backgroundTag":"record-not-found","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"}