sxyazi/yazi · error

unknown key: {s}

Error message

unknown key: {s}

What it means

Keymap parsing guard in `FromStr for Key`: after matching all named keys (arrows, F-keys, esc, etc.), the remaining token matched no known key name and, being the last token, cannot be interpreted as a modifier prefix. The faulting input is the unrecognized token `s` inside the key string.

Source

Thrown at yazi-config/src/keymap/key.rs:115

				"f10" => key.code = KeyCode::Fn(10),
				"f11" => key.code = KeyCode::Fn(11),
				"f12" => key.code = KeyCode::Fn(12),
				"f13" => key.code = KeyCode::Fn(13),
				"f14" => key.code = KeyCode::Fn(14),
				"f15" => key.code = KeyCode::Fn(15),
				"f16" => key.code = KeyCode::Fn(16),
				"f17" => key.code = KeyCode::Fn(17),
				"f18" => key.code = KeyCode::Fn(18),
				"f19" => key.code = KeyCode::Fn(19),
				"esc" => key.code = KeyCode::Escape,

				_ => match next {
					s if it.peek().is_none() => {
						let c = s.chars().next().unwrap();
						key.shift |= c.is_uppercase();
						key.code = KeyCode::Char(if key.shift { c.to_ascii_uppercase() } else { c });
					}
					s => bail!("unknown key: {s}"),
				},
			}
		}

		if key.code == KeyCode::Null {
			bail!("empty key")
		}
		Ok(key)
	}
}

impl Display for Key {
	fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
		if let Some(c) = self.plain() {
			return if c == ' ' { write!(f, "<Space>") } else { f.write_char(c) };
		}

		write!(f, "<")?;

View on GitHub (pinned to 5f901b886b)

Solutions

  1. Check the key name for typos against the supported set (e.g. `tab`, `enter`, `f1`-`f19`, `esc`).
  2. Use `<...>` syntax with valid modifiers (`<S-a>`, `<C-a>`, `<A-a>`).
  3. For plain characters, use the character itself.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at yazi-config/src/keymap/key.rs:115 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/d94ab080dc5b89d1. Report an issue: GitHub.