can1357/oh-my-pi · error · BindError

unknown function: {0}

Error message

unknown function: {0}

What it means

`BindError::UnknownFunction` is raised by the `bind` builtin in the brush shell (pi-builtins) when the user names a readline/editing function that does not exist in the shell's function table. `bind` maps key sequences to named input functions; if the function name supplied by the user is not recognized, this error is returned and the builtin exits with a general error exit code. It signals a typo or an unsupported function name rather than a system failure.

Source

Thrown at crates/pi-builtins/src/bind.rs:92

	#[arg(short = 'r', value_name = "KEY_SEQ")]
	remove_key_seq_binding: Option<String>,
	/// Import bindings from the given file.
	#[arg(short = 'f', value_name = "PATH")]
	bindings_file: Option<String>,
	/// Bind key sequence to command.
	#[arg(short = 'x', value_name = "BINDING")]
	key_seq_bindings: Vec<String>,
	/// List key sequence bindings.
	#[arg(short = 'X')]
	list_key_seq_bindings: bool,
	/// Key sequence binding to readline function or command.
	key_sequence: Option<String>,
}

#[derive(Debug, thiserror::Error)]
pub(crate) enum BindError {
	/// Unknown function specified.
	#[error("unknown function: {0}")]
	UnknownFunction(String),

	/// Unknown key binding function.
	#[error("unknown key binding function: {0}")]
	UnknownKeyBindingFunction(String),

	/// Unimplemented functionality.
	#[error("unimplemented: {0}")]
	Unimplemented(&'static str),

	/// An I/O error occurred.
	#[error("I/O error occurred")]
	IoError(#[from] std::io::Error),

	/// A binding parse error occurred.
	#[error(transparent)]
	BindingParseError(#[from] brush_parser::BindingParseError),
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Run `bind -l` to list all functions the shell supports and use an exact name from that list.
  2. Check spelling/casing of the function name; names must match exactly (e.g. `backward-word`, not `backward_word`).
  3. If the function genuinely is not implemented in brush, remove or guard that binding in your shell config instead of relying on it.

Example fix

// before
$ bind -q backword-word
unknown function: backword-word
// after
$ bind -l            # find the correct name
$ bind -q backward-word
Defensive patterns

Strategy: validation

Validate before calling

// shell-level check before scripting a bind query
if ! bind -l | grep -qx "$FUNC_NAME"; then
  echo "function not supported: $FUNC_NAME" >&2
  exit 1
fi

Prevention

When it happens

Trigger: Running `bind -q FUNC_NAME` (query_func_bindings) or `bind -u FUNC_NAME` (remove_func_bindings) with a function name that is not a known key-binding function; generally, any `bind` invocation that references a function by name which the shell cannot resolve.

Common situations: Typing a function name copied from bash documentation that brush does not implement; misspelling a function name (e.g. `bind -q backword-word` instead of `backward-word`); shell scripts written for real bash referencing readline functions absent from brush.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/0c843ac7bc0cfc2b. Report an issue: GitHub.