sxyazi/yazi · error
Cannot construct system event
Error message
Cannot construct system event
What it means
Ember (DDS event) validation (yazi-dds/src/ember/ember.rs:87) forbids external construction of events whose kind collides with Yazi's own namespaces: reserved body kinds like `theme`, any `key-*`, `ind-*`, `emit-*`, or `relay-*` prefix. Attempting to validate/construct such a kind bails because only Yazi itself may emit system events.
Source
Thrown at yazi-dds/src/ember/ember.rs:87
| "load"
| "hover"
| "rename"
| "bulk-rename"
| "@yank"
| "duplicate"
| "move"
| "trash"
| "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",View on GitHub (pinned to 5f901b886b)
Solutions
- Rename your event kind to something in your own namespace that does not use reserved prefixes (key-, ind-, emit-, relay-) or the reserved names like `theme`.
- If broadcasting a real system event, use the designated API (`ya emit`) rather than constructing it manually.
- Prefix custom events with `@` (static messages) or a unique vendor prefix.
Example fix
// before
Ember::validate("emit-my-event")?;
// after
Ember::validate("my-plugin:my-event")?; Defensive patterns
Strategy: validation
Validate before calling
const RESERVED: [&str; 1] = ["theme"];
fn kind_allowed(kind: &str) -> bool {
!RESERVED.contains(&kind)
&& !kind.starts_with("key-")
&& !kind.starts_with("ind-")
&& !kind.starts_with("emit-")
&& !kind.starts_with("relay-")
} Prevention
- Namespace custom plugin events with a unique prefix that avoids key-, ind-, emit-, relay-.
- Use `ya emit` for genuine system events instead of manual construction.
- Keep a list of reserved kinds in your plugin and assert against it in tests.
When it happens
Trigger: Calling `Ember::validate` (or constructing an Ember) with a kind string that equals a reserved kind (e.g. `theme`, `key-move`, `ind-start`) or begins with `emit-`, `relay-`, `key-`, `ind-`.
Common situations: Third-party plugin or remote client via `ya pub-emit`/DDS trying to emit an event that shadows Yazi's internal event names.
Related errors
- Kind `{kind}` must be in kebab-case
- {}
- Unknown error
- Expected custom payload of kind `{reply_kind}`
- Connection closed before receiving reply
AI-assisted analysis of sxyazi/yazi@5f901b886b (2026-09-02).
Data as JSON: /api/errors/e4f953f82fe39982.
Report an issue: GitHub.