sxyazi/yazi · error

Invalid mouse event: {s}

Error message

Invalid mouse event: {s}

What it means

Config parsing guard in `TryFrom<Vec<String>> for MouseEvents`: while folding the list of mouse event names from yazi.toml, one string matched none of the accepted events (`click`, `scroll`, `touch`, `move`, `drag`). The faulting input is that unrecognized string.

Source

Thrown at yazi-config/src/mgr/mouse.rs:29

		const SCROLL = 0b00010;
		const TOUCH  = 0b00100;
		const MOVE   = 0b01000;
		const DRAG   = 0b10000;
	}
}

impl TryFrom<Vec<String>> for MouseEvents {
	type Error = anyhow::Error;

	fn try_from(value: Vec<String>) -> Result<Self, Self::Error> {
		value.into_iter().try_fold(Self::empty(), |aac, s| {
			Ok(match s.as_str() {
				"click" => aac | Self::CLICK,
				"scroll" => aac | Self::SCROLL,
				"touch" => aac | Self::TOUCH,
				"move" => aac | Self::MOVE,
				"drag" => aac | Self::DRAG,
				_ => bail!("Invalid mouse event: {s}"),
			})
		})
	}
}

impl From<MouseEvents> for Vec<String> {
	fn from(value: MouseEvents) -> Self {
		let events = [
			(MouseEvents::CLICK, "click"),
			(MouseEvents::SCROLL, "scroll"),
			(MouseEvents::TOUCH, "touch"),
			(MouseEvents::MOVE, "move"),
			(MouseEvents::DRAG, "drag"),
		];
		events.into_iter().filter(|v| value.contains(v.0)).map(|v| v.1.to_owned()).collect()
	}
}

View on GitHub (pinned to 5f901b886b)

Solutions

  1. Use only `click`, `scroll`, `touch`, `move`, or `drag` in `mouse.events`.
  2. Remove the typo'd event name from the configuration.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at yazi-config/src/mgr/mouse.rs:29 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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