zed-industries/zed · error

in #[action] attribute: `name = "{name}" must not contain `:

Error message

in #[action] attribute: `name = "{name}" must not contain `::`, also specify `namespace` instead

What it means

The #[action] macro rejects action names that contain the path separator '::'. Name and namespace are stored separately so the registry can compose the full action id as namespace::name; a '::' inside name itself would create ambiguous, nested ids. If the name argument (or the fallback struct name) contains '::', the macro panics at compile time and points you to the namespace argument instead.

Source

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

                    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');
            }
        }
    }

    let name = name_argument.unwrap_or_else(|| struct_name.to_string());

    if name.contains("::") {
        panic!(
            "in #[action] attribute: `name = \"{name}\"` must not contain `::`, \
            also specify `namespace` instead"
        );
    }

    let full_name = if let Some(namespace) = namespace {
        format!("{namespace}::{name}")
    } else {
        name
    };

    let is_unit_struct = matches!(&input.data, Data::Struct(data) if data.fields.is_empty());

    let build_fn_body = if no_json {
        let error_msg = format!("{} cannot be built from JSON", full_name);
        quote! { Err(gpui::private::anyhow::anyhow!(#error_msg)) }
    } else if is_unit_struct {
        quote! { Ok(Box::new(Self)) }

View on GitHub (pinned to f4178619ac)

Solutions

  1. Move the qualifier into the namespace argument: #[action(namespace = "workspace", name = "split")]
  2. Or remove the '::' portion and let the action keep only the leaf name
  3. Re-run cargo check; the panic disappears once no name contains '::'

Example fix

// before
#[action(name = "workspace::split_pane")]
struct SplitPane;

// after
#[action(namespace = "workspace", name = "split_pane")]
struct SplitPane;
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Compiling an action declared as #[action(name = "workspace::split")] - i.e. a fully-qualified name pasted into the name argument - instead of splitting it into #[action(namespace = "workspace", name = "split")].

Common situations: Copying fully-qualified action id strings (like the "workspace::split" names that appear in keymaps or the command palette) into the name argument; refactoring or renaming actions and moving qualifiers into the name field by accident.

Related errors


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