sxyazi/yazi · error

Kind `{kind}` must be in kebab-case

Error message

Kind `{kind}` must be in kebab-case

What it means

The same Ember validation (yazi-dds/src/ember/ember.rs:95) enforces that event kinds are kebab-case: after optionally stripping the leading `@` (static-message prefix), every byte must be a digit, lowercase ASCII letter, or `-`. Any uppercase letter, underscore, dot, or other character bails.

Source

Thrown at yazi-dds/src/ember/ember.rs:95

				| "delete"
				| "download"
				| "input"
				| "mount"
				| "theme"
		) || kind.starts_with("key-")
			|| kind.starts_with("ind-")
			|| kind.starts_with("emit-")
			|| kind.starts_with("relay-")
		{
			bail!("Cannot construct system event");
		}

		let mut it = kind.bytes().peekable();
		if it.peek() == Some(&b'@') {
			it.next(); // Skip `@` as it's a prefix for static messages
		}
		if !it.all(|b| matches!(b, b'0'..=b'9' | b'a'..=b'z' | b'-')) {
			bail!("Kind `{kind}` must be in kebab-case");
		}

		Ok(())
	}
}

impl<'a> Ember<'a> {
	pub fn kind(&self) -> &str {
		match self {
			Self::Hi(_) => "hi",
			Self::Hey(_) => "hey",
			Self::Bye(_) => "bye",
			Self::Tab(_) => "tab",
			Self::Cd(_) => "cd",
			Self::Load(_) => "load",
			Self::Hover(_) => "hover",
			Self::Rename(_) => "rename",
			Self::BulkRename(_) => "bulk-rename",

View on GitHub (pinned to 5f901b886b)

Solutions

  1. Rewrite the kind in kebab-case, e.g. `my_event` -> `my-event`, `MyEvent` -> `my-event`.
  2. Sanitize/normalize the kind (lowercase, replace `_`/`.` with `-`) before validation.
  3. If it is a static message, confirm the `@` prefix is present so it is stripped before the kebab-case check.

Example fix

// before
Ember::validate("my_plugin_updated")?;
// after
Ember::validate("my-plugin-updated")?;
Defensive patterns

Strategy: validation

Validate before calling

fn is_kebab_kind(kind: &str) -> bool {
    let k = kind.strip_prefix('@').unwrap_or(kind);
    !k.is_empty()
        && k.bytes().all(|b| matches!(b, b'0'..=b'9' | b'a'..=b'z' | b'-'))
}

Prevention

When it happens

Trigger: Validating an Ember whose kind contains characters outside `0-9 a-z -` (after an optional leading `@`), e.g. `MyEvent`, `my_event`, `plugin.name.event`.

Common situations: Plugin authors naming events in camelCase or snake_case out of habit, or programmatically deriving kind names from filenames/identifiers that contain dots or underscores.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02). Data as JSON: /api/errors/65a084b63604ca3b. Report an issue: GitHub.