{"record":{"id":"636881f847b3a382","repo":"stamparm/maltrail","slug":"no-version-key-found-in-s","errorCode":null,"errorMessage":"[!] no version key found in %s","messagePattern":"\\[!\\] no version key found in (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"sensor/tools/check_version.py","lineNumber":70,"sourceCode":"    if not package:\n        raise SystemExit(\"[!] no [package] table found in %s\" % CARGO)\n    match = re.search(r\"^version\\s*=\\s*\\\"([^\\\"]+)\\\"\", package.group(1), re.M)\n    if not match:\n        raise SystemExit(\"[!] no version key in the [package] table of %s\" % CARGO)\n    return match.group(1)\n\n\ndef citation_version():\n    \"\"\"version: \"3.0\" from CITATION.cff.\n\n    Nothing linked this to the tree, and it drifted: the file still claimed 3.0 while the code,\n    the sensor and the published tag were all 3.1.1. That is not cosmetic - CITATION.cff exists\n    so a paper can cite a specific version, and it had been quietly citing the wrong one.\n    \"\"\"\n\n    match = re.search(r\"^version\\s*:\\s*[\\\"']([^\\\"']+)[\\\"']\", _read(CITATION), re.M)\n    if not match:\n        raise SystemExit(\"[!] no version key found in %s\" % CITATION)\n    return match.group(1)\n\n\ndef settings_gen_version():\n    \"\"\"pub const VERSION: &str = \"3.2\"; from the generated mirror of core/settings.py.\n\n    This is a FOURTH place the version lives, and it was the one nobody checked here. The Rust\n    parity test covers it, but that test needs a Rust toolchain - so the automated monthly bump,\n    which is a text edit on a machine that has none, could not tell it had gone stale. It found\n    out from a failed release: the tag was already pushed, the gate refused it, and nothing was\n    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","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/stamparm/maltrail/blob/77cfb06d7606506d101bbcec0786c77166c4255e/sensor/tools/check_version.py#L52-L88","documentation":"check_version.py extracts the version from CITATION.cff with a regex over a 'version:' key. If the file exists but has no version key (or it's formatted unusually, e.g. unquoted or different indentation/spacing), the regex fails and the tool exits with this message rather than silently returning a wrong version. This guards the release pipeline from citing the wrong paper version.","triggerScenarios":"Running check_version.py (via main) when sensor/../CITATION.cff lacks a line matching ^version: \"...\" — e.g. the key was renamed, removed, uses no quotes, or uses tabs instead of spaces after the colon.","commonSituations":"Hand-editing CITATION.cff during a release and accidentally dropping or reformatting the version key; a merge conflict resolved by deleting the key; committing a template CITATION.cff with placeholders.","solutions":["Open CITATION.cff and add/restore a top-level version key: version: \"3.2\"","Check the key uses 'version:' with regular spaces before the value and the value is quoted","Run check_version.py again to confirm all version sources agree","Validate the file with a CFF validator (cffconvert) to catch other schema issues"],"exampleFix":"// before (CITATION.cff missing key)\n# CITATION.cff\nauthors:\n  - ...\n// after\nauthors:\n  - ...\nversion: \"3.2\"","handlingStrategy":"validation","validationCode":"import re, pathlib\ntext = pathlib.Path(\"CITATION.cff\").read_text()\nassert re.search(r'^version\\s*:\\s*[\"\\'][^\"\\']+[\"\\']', text, re.M), \"CITATION.cff missing version key\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep version as the last line you never touch during manual edits","Validate CITATION.cff with cffconvert in CI","Never resolve merge conflicts by deleting the version key"],"tags":["python","release-tooling","citation-cff"],"backgroundTag":"missing-required-config-field","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"}