{"record":{"id":"d512b2447488ce5b","repo":"jdx/mise","slug":"command-output-exceeded-max-output-bytes-bytes","errorCode":null,"errorMessage":"command output exceeded {max_output_bytes} bytes","messagePattern":"command output exceeded (.+?) bytes","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd.rs","lineNumber":1393,"sourceCode":"                            let _ = tx.send(HashedProcessOutput::ReadError(\"stderr\", err)).await;\n                            break;\n                        }\n                    }\n                }\n            });\n        }\n        drop(tx);\n\n        let timeout_guard = self.timeout.map(|timeout| TimeoutGuard::new(timeout, id));\n        let mut stdout_hasher = blake3::Hasher::new();\n        let mut stderr_hasher = blake3::Hasher::new();\n        let mut output_bytes = 0usize;\n        let mut consume = |output: HashedProcessOutput| -> Result<()> {\n            match output {\n                HashedProcessOutput::Stdout(bytes) => {\n                    output_bytes = output_bytes.saturating_add(bytes.len());\n                    if output_bytes > max_output_bytes {\n                        bail!(\"command output exceeded {max_output_bytes} bytes\");\n                    }\n                    stdout_hasher.update(&bytes);\n                }\n                HashedProcessOutput::Stderr(bytes) => {\n                    output_bytes = output_bytes.saturating_add(bytes.len());\n                    if output_bytes > max_output_bytes {\n                        bail!(\"command output exceeded {max_output_bytes} bytes\");\n                    }\n                    stderr_hasher.update(&bytes);\n                }\n                HashedProcessOutput::ReadError(stream, err) => {\n                    bail!(\"failed to read command {stream}: {err}\");\n                }\n            }\n            Ok(())\n        };\n        let mut status = None;\n        let mut wait = Box::pin(cp.wait());","sourceCodeStart":1375,"sourceCodeEnd":1411,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cmd.rs#L1375-L1411","documentation":"In execute_hashes_async (drain-timeout variant), mise consumes stdout/stderr chunks as HashedProcessOutput while hashing them, enforcing a caller-supplied max_output_bytes cap. If combined output exceeds the cap, it immediately bails with `command output exceeded {max_output_bytes} bytes`, aborting the command rather than buffering unbounded output.","triggerScenarios":"Running a command via execute_hashes_async where the sum of stdout+stderr bytes across chunks (saturating_add'ed) exceeds max_output_bytes — e.g. a tool emitting verbose logs or a dump to stdout during install/checksum verification.","commonSituations":"Build tools printing enormous logs; a command accidentally catting a large file; debug builds with verbose tracing enabled inside install hooks; runaway retry loops printing errors repeatedly.","solutions":["Raise the max_output_bytes limit in the caller/configuration that invokes execute_hashes_async.","Silence or reduce the command's output (e.g. redirect verbose logs to a file, use --quiet flags).","Fix the command producing unexpected bulk output (diagnose what it prints)."],"exampleFix":"// before\nlet out = cmd.execute_hashes_async(max_output_bytes = 1_000_000).await?;\n// after\nlet out = cmd.execute_hashes_async(50_000_000).await?;\n// or quiet the command:\n// run = \"cargo build --quiet\"","handlingStrategy":"try-catch","validationCode":"test_out_size() { local s; s=$(\"$@\" 2>&1 | wc -c); [ \"$s\" -lt 5000000 ]; }","typeGuard":null,"tryCatchPattern":"match cmd.execute_hashes_async(limit).await {\n  Err(e) if e.to_string().contains(\"command output exceeded\") => {\n    // rerun with output redirected to a file or a larger limit\n  }\n  r => r?,\n}","preventionTips":["Quiet verbose build tools (`--quiet`, `2>/dev/null`) in install hooks","Redirect large logs to files instead of captured stdout","Set output caps well above the expected log size"],"tags":["output-limit","process","timeout"],"backgroundTag":"payload-too-large","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}