{"record":{"id":"4e704397c000973b","repo":"can1357/oh-my-pi","slug":"transparent-brush-parser-bindingparseerror","errorCode":null,"errorMessage":"transparent (brush_parser::BindingParseError)","messagePattern":"transparent \\(brush_parser::BindingParseError\\)","errorType":"exception","errorClass":"BindError","httpStatus":null,"severity":"error","filePath":"crates/pi-builtins/src/bind.rs","lineNumber":108,"sourceCode":"pub(crate) enum BindError {\n\t/// Unknown function specified.\n\t#[error(\"unknown function: {0}\")]\n\tUnknownFunction(String),\n\n\t/// Unknown key binding function.\n\t#[error(\"unknown key binding function: {0}\")]\n\tUnknownKeyBindingFunction(String),\n\n\t/// Unimplemented functionality.\n\t#[error(\"unimplemented: {0}\")]\n\tUnimplemented(&'static str),\n\n\t/// An I/O error occurred.\n\t#[error(\"I/O error occurred\")]\n\tIoError(#[from] std::io::Error),\n\n\t/// A binding parse error occurred.\n\t#[error(transparent)]\n\tBindingParseError(#[from] brush_parser::BindingParseError),\n}\n\nimpl brush_core::BuiltinError for BindError {}\n\nimpl From<&BindError> for brush_core::ExecutionExitCode {\n\tfn from(_err: &BindError) -> Self {\n\t\tSelf::GeneralError\n\t}\n}\n\nimpl builtins::Command for BindCommand {\n\ttype Error = BindError;\n\n\tasync fn execute<SE: brush_core::ShellExtensions>(\n\t\t&self,\n\t\tcontext: brush_core::ExecutionContext<'_, SE>,\n\t) -> Result<brush_core::ExecutionResult, Self::Error> {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-builtins/src/bind.rs#L90-L126","documentation":"`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.","triggerScenarios":"`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.","commonSituations":"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.","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."],"exampleFix":"// before\n$ bind '\"\\C-x func'          # missing closing quote and colon\nparse error in binding\n// after\n$ bind '\"\\C-x\": func'","handlingStrategy":"validation","validationCode":"// shell: quote the full binding and use well-formed keyseq escapes\nBINDING='\"\\C-x\\C-s\": save-line'\n# sanity check: must contain a colon separating keyseq from function\n[[ \"$BINDING\" == *\":\"* ]] || { echo \"malformed binding: $BINDING\" >&2; exit 1; }\nbind \"$BINDING\"","typeGuard":"// Rust caller: inspect the wrapped parse error\nif let BindError::BindingParseError(e) = &err {\n    eprintln!(\"binding syntax error: {e}\");\n}","tryCatchPattern":"// shell: report and continue on bad binding lines in an imported file\nwhile IFS= read -r line; do\n  bind \"$line\" || echo \"bad binding line: $line\" >&2\ndone < ~/.inputrc","preventionTips":["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."],"tags":["shell","builtin","parse-error","key-binding"],"backgroundTag":"parse-error","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}