jdx/mise · error
container inspection returned an unexpected number of rows
Error message
container inspection returned an unexpected number of rows
What it means
Thrown by `add_container_hashes` (during `inspect`) after labeling containers with `docker inspect --format '{{json .Config.Labels}}'`: the number of output lines did not match the number of inspected containers. The library assumes a 1:1 row-per-container result, so a mismatch indicates the engine returned unexpected output and it aborts rather than mapping hashes incorrectly.
Solutions
- Re-run the mise command; if a container was being torn down concurrently, the race resolves itself
- Ensure the configured compose command/engine is Docker Compose v2 with clean stdout behavior
- Check engine health (`docker ps`) and retry after containers settle
Defensive patterns
Strategy: retry
Validate before calling
// preflight: ensure engine responds and containers are stable
docker ps --format '{{.ID}}' Try / catch
match inspect_result {
Err(e) if e.to_string().contains("unexpected number of rows") => retry_with_backoff(2),
other => other,
} Prevention
- Avoid concurrent compose down/up while mise inspects the project
- Use standard Docker Compose v2 frontends with clean stdout
- Retry transiently; the failure is usually a race
When it happens
Trigger: The container engine (docker/podman) returns fewer or more lines than the IDs passed to inspect — e.g. a container exits/is removed between listing and inspection, the engine emits extra warnings on stdout, or a non-Compose frontend prints additional lines.
Common situations: Racy container lifecycle during a concurrent `compose down`/restart; using a compose wrapper whose output is polluted; engine versions that print notices on stdout instead of stderr.
Related errors
- affected project exists in graph
- an operation record always has an operation
- attestation requests must not have a streaming body
- `auth` for is not `user:password
- get failed for
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/1d93fa1ac8fcd854.
Report an issue: GitHub.
Appendix: source
Thrown at src/system/compose.rs:611
fn add_container_hashes(&self, containers: &mut [ComposeContainer]) -> Result<()> {
if containers.is_empty() {
return Ok(());
}
let ids = containers
.iter()
.map(|container| container.id.clone())
.collect::<Vec<_>>();
let mut args = vec![
"inspect".to_string(),
"--format".to_string(),
"{{json .Config.Labels}}".to_string(),
];
args.extend(ids);
let output = self.engine_output(&args)?;
let lines = output.lines().collect::<Vec<_>>();
if lines.len() != containers.len() {
bail!("container inspection returned an unexpected number of rows");
}
for (container, line) in containers.iter_mut().zip(lines) {
let labels: HashMap<String, String> = serde_json::from_str(line)?;
container.config_hash = labels.get("com.docker.compose.config-hash").cloned();
}
Ok(())
}
fn desired(&self) -> String {
match self.state {
ComposeState::Running => format!(
"running{}; pull {:?}; build {:?}; recreate {:?}; wait {}",
selected_suffix(&self.services),
self.pull,
self.build,
self.recreate,
self.wait
)View on GitHub (pinned to 533346cc37)