Hmbown/CodeWhale · error · std::io::Error
project hooks file exceeds the 1 MiB limit
Error message
project hooks file exceeds the 1 MiB limit
What it means
Size guard in read_project_hooks_file: the project's hooks configuration file is larger than PROJECT_HOOKS_FILE_MAX_BYTES (1 MiB). Because hooks files are executable configuration read at startup, an oversized file is rejected to bound startup memory allocation from a possibly untrusted repo.
Source
Thrown at crates/tui/src/hooks/config.rs:16
use serde::{Deserialize, Serialize};
use std::io::Read as _;
use std::path::{Path, PathBuf};
/// Project hook files are executable configuration and must not become an
/// unbounded startup allocation merely because a trusted repository supplied
/// a very large file.
const PROJECT_HOOKS_FILE_MAX_BYTES: usize = 1024 * 1024;
fn read_project_hooks_file(path: &Path) -> std::io::Result<String> {
let file = std::fs::File::open(path)?;
let mut contents = String::new();
file.take((PROJECT_HOOKS_FILE_MAX_BYTES + 1) as u64)
.read_to_string(&mut contents)?;
if contents.len() > PROJECT_HOOKS_FILE_MAX_BYTES {
return Err(std::io::Error::new(
std::io::ErrorKind::InvalidData,
"project hooks file exceeds the 1 MiB limit",
));
}
Ok(contents)
}
/// Events that can trigger hook execution
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum HookEvent {
/// Triggered when a new session starts
SessionStart,
/// Triggered when a session ends (quit, Ctrl+C)
SessionEnd,
/// Triggered before a user message is sent to the LLM
MessageSubmit,
/// Triggered before a tool is executedView on GitHub (pinned to 0c42157ee5)
Solutions
- Reduce the hooks file below 1 MiB by removing unused hook entries or comments.
- Split hooks into multiple smaller files if the project's hook configuration genuinely needs more space.
- Check for accidental commits of large generated files at the hooks path.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/tui/src/hooks/config.rs:16 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/eaca556a7603ae42.
Report an issue: GitHub.