{"record":{"id":"427588df9d609478","repo":"cross-rs/cross","slug":"most-common-base-image-is-max-base-but-source-code-has","errorCode":null,"errorMessage":"most common base image is {max_base} but source code has {actual_base}","messagePattern":"most common base image is (.+?) but source code has (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"xtask/src/util.rs","lineNumber":448,"sourceCode":"                .nth(1)\n                .ok_or_else(|| eyre::eyre!(\"invalid FROM instruction, got {}\", lines[index]))?;\n            if let Some(value) = counts.get_mut(tag) {\n                *value += 1;\n            } else {\n                counts.insert(tag.to_string(), 1);\n            }\n        }\n\n        // Now, get the most common and ensure our base is correct.\n        let actual_base = cross::docker::UBUNTU_BASE;\n        let max_base = counts\n            .iter()\n            .max_by(|x, y| x.1.cmp(y.1))\n            .map(|(k, _)| k)\n            .ok_or_else(|| eyre::eyre!(\"have no dockerfiles\"))?;\n\n        if actual_base != max_base {\n            eyre::bail!(\"most common base image is {max_base} but source code has {actual_base}\")\n        } else {\n            Ok(())\n        }\n    }\n}\n","sourceCodeStart":430,"sourceCodeEnd":454,"githubUrl":"https://github.com/cross-rs/cross/blob/8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27/xtask/src/util.rs#L430-L454","documentation":"check_ubuntu_base aggregates the base images declared across the repository's Dockerfiles and compares the most frequently used one against the Ubuntu base version recorded in the source code (a constant). If the two disagree it bails with this error, keeping the source-of-truth constant in sync with the actual dockerfiles. It fails either when the constant was bumped without updating dockerfiles or vice versa.","triggerScenarios":"Running the xtask check whose Dockerfile directory contains no dockerfiles (separate 'have no dockerfiles' error) or whose most common FROM base image differs from the `actual_base` constant, e.g. after editing some Dockerfiles to a newer Ubuntu release while the source constant still names the old one (or the reverse).","commonSituations":"A PR bumps a few Dockerfiles to ubuntu:24.04 while others (and the constant) still say 22.04; a refactor renames the base image string slightly; or the constant was updated in source but Dockerfiles were forgotten, so CI's consistency check fails.","solutions":["Update the Ubuntu base constant in xtask source to match the most common Dockerfile base (or vice versa) so both agree.","Update the minority of Dockerfiles that still use the old base image so the most common base matches the constant.","Re-run the xtask check locally to confirm the counts align before pushing."],"exampleFix":"// before (src constant)\npub const UBUNTU_BASE: &str = \"ubuntu:22.04\"; // dockerfiles use 24.04\n\n// after\npub const UBUNTU_BASE: &str = \"ubuntu:24.04\";","handlingStrategy":"validation","validationCode":"grep -h '^FROM' **/Dockerfile* | sort | uniq -c  # compare top base with the UBUNTU_BASE constant","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Bump the source constant and all Dockerfiles in the same PR.","Run the xtask base-image check locally before pushing.","Derive Dockerfile FROM lines from the constant (templating) instead of hand-editing each file."],"tags":["docker","ci","consistency-check","config-drift"],"backgroundTag":"invalid-config-value","analyzedSha":"8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27","analyzedAt":"2026-09-13T15:10:43.988Z","contentChangedAt":"2026-09-13T15:10:43.988Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}