zed-industries/zed · error

Binary files are not supported

Error message

Binary files are not supported

What it means

Guard in the buffer's reload_impl: after loading the file's bytes from disk, analyze_byte_content classified the content as ByteContent::Binary, so it cannot be decoded as text into the buffer. Zed refuses to load binary files as editable text buffers; this fires on reload/reopen of a file that is (or has become) binary, such as images, archives, or executables.

Source

Thrown at crates/language/src/buffer.rs:1631

        if modeline.as_ref() != self.modeline.as_deref() {
            self.modeline = modeline.map(Arc::new);
            self.refresh_resolved_settings(cx);
            true
        } else {
            false
        }
    }

    /// Returns the [`ModelineSettings`].
    pub fn modeline(&self) -> Option<&Arc<ModelineSettings>> {
        self.modeline.as_ref()
    }

    /// Assign the buffer a new [`Capability`].
    pub fn set_capability(&mut self, capability: Capability, cx: &mut Context<Self>) {
        if self.capability != capability {
            self.capability = capability;
            cx.emit(BufferEvent::CapabilityChanged)
        }
    }

    /// This method is called to signal that the buffer has been saved.
    pub fn did_save(
        &mut self,
        version: clock::Global,
        mtime: Option<MTime>,
        cx: &mut Context<Self>,
    ) {
        self.saved_version = version.clone();
        self.has_unsaved_edits.set((version, false));
        self.has_conflict = false;
        self.saved_mtime = mtime;
        self.was_changed();
        cx.emit(BufferEvent::Saved);
        cx.notify();
    }

View on GitHub (pinned to 9d272b0363)

Solutions

  1. Open the file with an appropriate binary viewer or external tool instead of the text editor
  2. If the file should be text, check for corruption or a wrong extension/encoding
  3. Force the correct encoding with reload_with_encoding if the file is text in a non-Unicode encoding
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/language/src/buffer.rs:1616 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/979cd8ee29621aa5. Report an issue: GitHub.