can1357/oh-my-pi · error · BindError
transparent (brush_parser::BindingParseError)
Error message
transparent (brush_parser::BindingParseError)
What it means
`BindError::BindingParseError` transparently wraps `brush_parser::BindingParseError`, produced when the `bind` builtin cannot parse a key-binding specification (e.g. the text after `-f` file import or an inline `KEYSEQ:FUNC` binding string). The `#[error(transparent)]` attribute means the Display output is exactly the parser's own message, describing the malformed binding syntax.
Source
Thrown at crates/pi-builtins/src/bind.rs:108
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),
}
impl brush_core::BuiltinError for BindError {}
impl From<&BindError> for brush_core::ExecutionExitCode {
fn from(_err: &BindError) -> Self {
Self::GeneralError
}
}
impl builtins::Command for BindCommand {
type Error = BindError;
async fn execute<SE: brush_core::ShellExtensions>(
&self,
context: brush_core::ExecutionContext<'_, SE>,
) -> Result<brush_core::ExecutionResult, Self::Error> {View on GitHub (pinned to 9690622007)
Solutions
- Read the transparent parser message to find the offending line/character and fix the binding syntax.
- Escape key sequences per brush's grammar (e.g. `\C-x`, `\M-x`, `\e`); quote the whole binding argument for the shell.
- Validate the file by importing a minimal version with one binding at a time to isolate the bad line.
- Replace unsupported .inputrc directives (conditionals, macros) with plain keyseq:function lines.
Example fix
// before $ bind '"\C-x func' # missing closing quote and colon parse error in binding // after $ bind '"\C-x": func'
Defensive patterns
Strategy: validation
Validate before calling
// shell: quote the full binding and use well-formed keyseq escapes
BINDING='"\C-x\C-s": save-line'
# sanity check: must contain a colon separating keyseq from function
[[ "$BINDING" == *":"* ]] || { echo "malformed binding: $BINDING" >&2; exit 1; }
bind "$BINDING" Type guard
// Rust caller: inspect the wrapped parse error
if let BindError::BindingParseError(e) = &err {
eprintln!("binding syntax error: {e}");
} Try / catch
// shell: report and continue on bad binding lines in an imported file while IFS= read -r line; do bind "$line" || echo "bad binding line: $line" >&2 done < ~/.inputrc
Prevention
- Always quote binding arguments so the outer shell doesn't eat backslashes or quotes.
- Validate imported files line-by-line to isolate syntax errors quickly.
- Keep .inputrc/bind syntax minimal — avoid directives the brush parser doesn't support.
When it happens
Trigger: `bind -f FILE` where the file contains a syntactically invalid binding line; inline binding strings like `bind '"\C-x": func'` with bad keyseq escape syntax or missing quotes/colon; importing an .inputrc with directives brush's parser rejects.
Common situations: Hand-edited .inputrc with a typo (unbalanced quotes, invalid escape like `\C-`); copying bash bind syntax that differs from brush's expected grammar; a bindings file generated by another tool in an incompatible format.
Related errors
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/4e704397c000973b.
Report an issue: GitHub.