{"record":{"id":"0c0c7bc8d023a2d3","repo":"can1357/oh-my-pi","slug":"i-o-error-occurred","errorCode":null,"errorMessage":"I/O error occurred","messagePattern":"I/O error occurred","errorType":"exception","errorClass":"BindError","httpStatus":null,"severity":"error","filePath":"crates/pi-builtins/src/bind.rs","lineNumber":104,"sourceCode":"\tkey_sequence: Option<String>,\n}\n\n#[derive(Debug, thiserror::Error)]\npub(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","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-builtins/src/bind.rs#L86-L122","documentation":"`BindError::IoError` wraps a `std::io::Error` (via `#[from]`) encountered by the `bind` builtin, typically while reading a bindings file passed with `-f` or other file/stdin access. The displayed message is intentionally generic — the underlying OS error detail is lost in the formatted output, though it remains in the variant payload.","triggerScenarios":"`bind -f PATH` where PATH cannot be opened (missing file, permission denied); any read/write on a bindings file or terminal fd that fails with an io::Error propagated via the `?`/`#[from]` conversion.","commonSituations":"Typo in the `-f` bindings file path; file exists but the shell user lacks read permission; trying to import a directory instead of a file; scripts assuming a bindings file was created by an earlier step but it was not.","solutions":["Verify the file path passed to `bind -f` exists and is readable (`ls -l`, `cat` it manually).","Fix file permissions or run under a user with access.","If the detail matters, run with debug/tracing enabled (trace_categories in brush) to capture the wrapped io::Error."],"exampleFix":"// before\n$ bind -f ~/.inputrc-bak\nI/O error occurred\n// after\n$ ls ~/.inputrc*   # find the real filename\n$ bind -f ~/.inputrc.backup","handlingStrategy":"try-catch","validationCode":"// shell-level: confirm the bindings file is readable first\nBIND_FILE=~/.inputrc\nif [ ! -r \"$BIND_FILE\" ]; then\n  echo \"cannot read bindings file: $BIND_FILE\" >&2\n  exit 1\nfi\nbind -f \"$BIND_FILE\"","typeGuard":"// Rust caller pattern: match on the variant before handling\nif let BindError::IoError(io) = &err {\n    eprintln!(\"bind I/O failure: {io}\");\n}","tryCatchPattern":"// shell: tolerate bind import failure without killing the session\nif ! bind -f ~/.inputrc; then\n  echo \"warning: failed to load key bindings\" >&2\nfi","preventionTips":["Check file existence and permissions before every `bind -f` call.","Create the bindings file in the same setup step that consumes it.","Never point -f at directories or files owned by other users."],"tags":["shell","builtin","io","file-not-found"],"backgroundTag":"io-error","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}