jdx/mise · error

command output exceeded {max_output_bytes} bytes

Error message

command output exceeded {max_output_bytes} bytes

What it means

While streaming a child process's stdout for hashing (execute_hashes_async), the accumulated output exceeded max_output_bytes and mise aborted with `command output exceeded <N> bytes`. This guard prevents unbounded memory/consumption when capturing command output.

Source

Thrown at src/cmd.rs:1383

                            let _ = tx.send(HashedProcessOutput::ReadError("stderr", err)).await;
                            break;
                        }
                    }
                }
            });
        }
        drop(tx);

        let timeout_guard = self.timeout.map(|timeout| TimeoutGuard::new(timeout, id));
        let mut stdout_hasher = blake3::Hasher::new();
        let mut stderr_hasher = blake3::Hasher::new();
        let mut output_bytes = 0usize;
        let mut consume = |output: HashedProcessOutput| -> Result<()> {
            match output {
                HashedProcessOutput::Stdout(bytes) => {
                    output_bytes = output_bytes.saturating_add(bytes.len());
                    if output_bytes > max_output_bytes {
                        bail!("command output exceeded {max_output_bytes} bytes");
                    }
                    stdout_hasher.update(&bytes);
                }
                HashedProcessOutput::Stderr(bytes) => {
                    output_bytes = output_bytes.saturating_add(bytes.len());
                    if output_bytes > max_output_bytes {
                        bail!("command output exceeded {max_output_bytes} bytes");
                    }
                    stderr_hasher.update(&bytes);
                }
                HashedProcessOutput::ReadError(stream, err) => {
                    bail!("failed to read command {stream}: {err}");
                }
            }
            Ok(())
        };
        let mut status = None;
        let mut wait = Box::pin(cp.wait());

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Reduce the command's stdout volume (redirect to a file, quiet flags like -q/--silent).
  2. Raise max_output_bytes at the call site/configuration if large output is expected.
  3. Fix runaway output (loops, debug prints) in the script being executed.
  4. Stream results to disk instead of hashing in-memory output if the data is legitimately huge.

Example fix

// before (task script)
cat huge.json
# command output exceeded 1048576 bytes
// after
jq -r '.key' huge.json  # or: cat huge.json > /tmp/out.json && jq -r '.key' /tmp/out.json
Defensive patterns

Strategy: validation

Validate before calling

bytes=$(command | wc -c); [ "$bytes" -le 1048576 ] || echo 'output exceeds max_output_bytes — redirect to file'

Try / catch

out=$(cmd 2>/dev/null | head -c 1048576) || { tail_log_file_instead; }

Prevention

When it happens

Trigger: Any command executed through execute_hashes_async (used for checksummed/captured output, e.g. script/env-file execution) whose combined stdout exceeds the configured max_output_bytes cap; the check fires in the stdout arm of the consume closure.

Common situations: Scripts that dump very large files to stdout; verbose/debug logging enabled in an env hook; accidentally catting a large binary or log; a runaway loop printing continuously.

Understand the failure class

Background: payload too large / request exceeds maximum size: why libraries cap bytes and how to fix oversize payloads — this error's family across 50 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/d512b2447488ce5b. Report an issue: GitHub.