zed-industries/zed · error
File is too large to load
Error message
File is too large to load
What it means
Loading a file via worktree is skipped because the file exceeds the size limit; as a workaround for memory blowup (#27283, ~64GB RAM for a 10GB file), the worktree bails before reading to prevent system freezes.
Source
Thrown at crates/worktree/src/worktree.rs:1725
let abs_path = self.absolutize(&path);
let fs = self.fs.clone();
let entry = self.refresh_entry(path.clone(), None, cx);
let is_private = self.is_path_private(path.as_ref());
let this = cx.weak_entity();
cx.background_spawn(async move {
// WARN: Temporary workaround for #27283.
// We are not efficient with our memory usage per file, and use in excess of 64GB for a 10GB file
// Therefore, as a temporary workaround to prevent system freezes, we just bail before opening a file
// if it is too large
// 5GB seems to be more reasonable, peaking at ~16GB, while 6GB jumps up to >24GB which seems like a
// reasonable limit
const FILE_SIZE_MAX: u64 = 6 * 1024 * 1024 * 1024; // 6GB
let metadata = fs.metadata(&abs_path).await?;
if let Some(metadata) = metadata.as_ref()
&& metadata.len >= FILE_SIZE_MAX
{
anyhow::bail!("File is too large to load");
}
let (text, line_ending, encoding, has_bom) =
decode_file_text_to_rope(fs.as_ref(), &abs_path).await?;
let is_writable = metadata.is_some_and(|metadata| metadata.is_writable);
let worktree = this.upgrade().context("worktree was dropped")?;
let file = match entry.await? {
Some(entry) => File::for_entry(entry, worktree),
None => {
let metadata = fs
.metadata(&abs_path)
.await
.with_context(|| {
format!("Loading metadata for excluded file {abs_path:?}")
})?
.with_context(|| {
format!("Excluded file {abs_path:?} got removed during loading")
})?;View on GitHub (pinned to 9d272b0363)
Solutions
- Open a smaller file or reduce the selection; this guard exists because memory usage per loaded file can exceed 6x file size (workaround for #27283)
- Increase available system memory or raise the configured size limit if the environment allows it
- Use terminal commands or external tools to inspect the large file instead of loading it in the editor
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at crates/worktree/src/worktree.rs:1719 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of zed-industries/zed@9d272b0363 (2026-08-20).
Data as JSON: /api/errors/9a70cf81ffe5f4be.
Report an issue: GitHub.