cross-rs/cross · error
most common base image is
Error message
most common base image is {max_base} but source code has {actual_base} What it means
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.
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.
Example fix
// before (src constant) pub const UBUNTU_BASE: &str = "ubuntu:22.04"; // dockerfiles use 24.04 // after pub const UBUNTU_BASE: &str = "ubuntu:24.04";
Defensive patterns
Strategy: validation
Validate before calling
grep -h '^FROM' **/Dockerfile* | sort | uniq -c # compare top base with the UBUNTU_BASE constant
Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Refusing to push without tag or branch. Specify a…
- no valid choice to pick for image name
- unexpected progress type: expected plain, auto, or tty and…
- cannot make definite Image from unqualified PossibleImage
- invalid platform specified
AI-assisted analysis of cross-rs/cross@8c1a8aa4b6 (2026-09-13).
Data as JSON: /api/errors/427588df9d609478.
Report an issue: GitHub.
Appendix: source
Thrown at xtask/src/util.rs:448
.nth(1)
.ok_or_else(|| eyre::eyre!("invalid FROM instruction, got {}", lines[index]))?;
if let Some(value) = counts.get_mut(tag) {
*value += 1;
} else {
counts.insert(tag.to_string(), 1);
}
}
// Now, get the most common and ensure our base is correct.
let actual_base = cross::docker::UBUNTU_BASE;
let max_base = counts
.iter()
.max_by(|x, y| x.1.cmp(y.1))
.map(|(k, _)| k)
.ok_or_else(|| eyre::eyre!("have no dockerfiles"))?;
if actual_base != max_base {
eyre::bail!("most common base image is {max_base} but source code has {actual_base}")
} else {
Ok(())
}
}
}
View on GitHub (pinned to 8c1a8aa4b6)