zed-industries/zed · error

All actions in all_names should be registered

Error message

All actions in all_names should be registered

What it means

A registry consistency invariant in action_schemas: the actions registry maintains by_name alongside all_names, and generating JSON schemas iterates all_names expecting each to resolve in by_name. The expect fires only if the two collections diverge — an action name was recorded in all_names without being registered (or was deregistered from by_name only), which is a bug in registration ordering or in a test that mutates the registry.

Source

Thrown at crates/gpui/src/action.rs:386

        })
    }

    pub fn all_action_names(&self) -> &[&'static str] {
        self.all_names.as_slice()
    }

    pub fn action_schemas(
        &self,
        generator: &mut schemars::SchemaGenerator,
    ) -> Vec<(&'static str, Option<schemars::Schema>)> {
        // Use the order from all_names so that the resulting schema has sensible order.
        self.all_names
            .iter()
            .map(|name| {
                let action_data = self
                    .by_name
                    .get(name)
                    .expect("All actions in all_names should be registered");
                (*name, (action_data.json_schema)(generator))
            })
            .collect::<Vec<_>>()
    }

    pub fn action_schema_by_name(
        &self,
        name: &str,
        generator: &mut schemars::SchemaGenerator,
    ) -> Option<Option<schemars::Schema>> {
        self.by_name
            .get(name)
            .map(|action_data| (action_data.json_schema)(generator))
    }

    pub fn deprecated_aliases(&self) -> &HashMap<&'static str, &'static str> {
        &self.deprecated_aliases
    }

View on GitHub (pinned to f4178619ac)

Solutions

  1. Make registration update all_names and by_name together so divergence is unrepresentable
  2. Skip missing names (or surface them in the schema output as errors) instead of panicking when generating schemas
  3. Add a registry self-check test asserting every all_names entry resolves in by_name
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/gpui/src/action.rs:386 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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