zed-industries/zed · error

true schema should serialize

Error message

true schema should serialize

What it means

LazyLock clone-site for schema lookups: resolve_static_schema matched a known schema name (tsconfig, package_json, tasks, snippets, jsonc, keymap) and the corresponding static schema string is being handed out. The asserted initialization already happened once lazily; if serialization of the schema ever failed the first access would have panicked there, not here — this site only surfaces the precomputed value.

Source

Thrown at crates/json_schema_store/src/json_schema_store.rs:191

    let schema_name = schema_name.unwrap_or(path);

    match schema_name {
        "tsconfig" => Some(TSCONFIG_SCHEMA.to_string()),
        "package_json" => Some(PACKAGE_JSON_SCHEMA.to_string()),
        "tasks" => Some(TASKS_SCHEMA.clone()),
        "snippets" => Some(SNIPPETS_SCHEMA.clone()),
        "jsonc" => Some(JSONC_SCHEMA.clone()),
        "keymap" => Some(KEYMAP_SCHEMA.clone()),
        "zed_inspector_style" => {
            #[cfg(debug_assertions)]
            {
                Some(INSPECTOR_STYLE_SCHEMA.clone())
            }
            #[cfg(not(debug_assertions))]
            {
                Some(
                    serde_json::to_string(&schemars::json_schema!(true).to_value())
                        .expect("true schema should serialize"),
                )
            }
        }

        "action" => {
            let normalized_action_name = match rest {
                Some(name) => name,
                None => return None,
            };
            let action_name = denormalize_action_name(normalized_action_name);

            if let Some(cached) = ACTION_SCHEMA_CACHE.read().get(&action_name).cloned() {
                return Some(cached);
            }

            let mut generator = settings::KeymapFile::action_schema_generator();
            let schema =
                settings::KeymapFile::get_action_schema_by_name(&action_name, &mut generator);

View on GitHub (pinned to f4178619ac)

Solutions

  1. If this fires, inspect which static schema failed and fix the underlying generate_json_schema/serialize call for that settings type
  2. Add serialization smoke tests for every static schema to catch failures at build time rather than first request
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at crates/json_schema_store/src/json_schema_store.rs:191 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/eb258240424c886a. Report an issue: GitHub.