zed-industries/zed · error

failed to load language {language_name}: {e}

Error message

failed to load language {language_name}: {e}

What it means

Wrapper error in load_language's completion path: the language's async loader (or its grammar load) failed, and while draining the queued oneshot senders for waiters, a replacement language id could be found but reloading it also failed, so all waiters receive this error wrapping the underlying message. It means language {language_name} could not be made available — the root cause is the inner error (e.g. WASM grammar load failure, missing extension files, or a panic in the language's load closure).

Source

Thrown at crates/language/src/language_registry.rs:697

            if loaded_language.id == language_id {
                tx.send(Ok(loaded_language.clone())).unwrap();
                return rx;
            }
        }

        let Some(available_language) = state.available_languages.get_language(language_id) else {
            tx.send(Err(anyhow!(LanguageNotFound))).ok();
            return rx;
        };

        let (language_name, language_load) = (
            available_language.name.clone(),
            available_language.load.clone(),
        );

        match state.loading_languages.entry(language_id) {
            // If the language is already being loaded, then add this
            // channel to a list that will be sent to when the load completes.
            hash_map::Entry::Occupied(mut entry) => entry.get_mut().push(tx),

            // Otherwise, start loading the language.
            hash_map::Entry::Vacant(entry) => {
                let this = self.clone();

                self.executor
                    .spawn(async move {
                        let language = async {
                            let loaded_language = (language_load)().await?;
                            if let Some(grammar) = loaded_language.config.grammar.clone() {
                                let grammar = Some(this.get_or_load_grammar(grammar).await?);

                                Language::new_with_id(language_id, loaded_language.config, grammar)
                                    .with_context_provider(loaded_language.context_provider)
                                    .with_toolchain_lister(loaded_language.toolchain_provider)
                                    .with_manifest(loaded_language.manifest_name)
                                    .with_queries(loaded_language.queries)

View on GitHub (pinned to 5a9b9558db)

Solutions

  1. Inspect the inner error ({e}) for the root cause — commonly a corrupted or missing grammar WASM file
  2. Reinstall or update the language extension that provides this language
  3. Retry loading; some failures (e.g. transient extension download problems) are recoverable
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/language/src/language_registry.rs:689 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zed-industries/zed@5a9b9558db (2026-08-20). Data as JSON: /api/errors/706a8971dbd2188e. Report an issue: GitHub.