zed-industries/zed · error

in #[action] attribute: {}

Error message

in #[action] attribute: {}

What it means

This panic comes from the #[action] proc macro in gpui_macros while it parses the attribute arguments on an action struct. When the macro meets an argument that is not one of the recognized keys, syn parsing fails and the macro panics with the parse error text, aborting compilation. Recognized keys are namespace, no_json, no_register, deprecated_aliases, and deprecated.

Source

Thrown at crates/gpui_macros/src/derive_action.rs:84

                    )?;
                    deprecated_aliases.extend(aliases.into_iter().map(|lit| lit.value()));
                } else if meta.path.is_ident("deprecated") {
                    if deprecated.is_some() {
                        return Err(meta.error("'deprecated' argument specified multiple times"));
                    }
                    meta.input.parse::<Token![=]>()?;
                    let lit: LitStr = meta.input.parse()?;
                    deprecated = Some(lit.value());
                } else {
                    return Err(meta.error(format!(
                        "'{:?}' argument not recognized, expected \
                        'namespace', 'no_json', 'no_register, 'deprecated_aliases', or 'deprecated'",
                        meta.path
                    )));
                }
                Ok(())
            })
            .unwrap_or_else(|e| panic!("in #[action] attribute: {}", e));
        } else if attr.path().is_ident("doc") {
            use syn::{Expr::Lit, ExprLit, Lit::Str, Meta, MetaNameValue};
            if let Meta::NameValue(MetaNameValue {
                value:
                    Lit(ExprLit {
                        lit: Str(ref lit_str),
                        ..
                    }),
                ..
            }) = attr.meta
            {
                let doc = lit_str.value();
                let doc_str = doc_str.get_or_insert_default();
                doc_str.push_str(doc.trim());
                doc_str.push('\n');
            }
        }
    }

View on GitHub (pinned to f4178619ac)

Solutions

  1. Read the compiler output around the panic: the message lists the expected keys (namespace, no_json, no_register, deprecated_aliases, deprecated)
  2. Fix the attribute to use only supported keys with correct types, e.g. #[action(namespace = "zed", deprecated = "old name")]
  3. Pin/update gpui and gpui_macros to the version whose attribute grammar you are following, since accepted arguments changed across releases
  4. If you need a new argument, add it explicitly to the parser loop in crates/gpui_macros/src/derive_action.rs rather than guessing

Example fix

// before
#[action(deprecated_alises = "Split")]
struct SplitPane;

// after
#[action(deprecated_aliases = "Split")]
struct SplitPane;
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Writing an action attribute with a typo or unknown key, e.g. #[action(deprecated_alises = "x")] or #[action(priority = 3)], or using a bare flag where a key = "value" pair is required. The panic occurs at compile time when cargo builds any crate containing the bad attribute.

Common situations: Misspelling one of the five accepted keys; copying attribute syntax from an older or newer gpui release whose accepted arguments differ; passing positional arguments to a macro that only accepts key-value pairs.

Related errors


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