{"record":{"id":"91e79b53146c5551","repo":"influxdata/influxdb","slug":"error-reading-file-0","errorCode":null,"errorMessage":"error reading file: {0}","messagePattern":"error reading file: (.+?)","errorType":"error_code","errorClass":"Error::Io","httpStatus":null,"severity":"error","filePath":"influxdb3_commands/src/write.rs","lineNumber":35,"sourceCode":"    time::{Duration, Instant},\n};\nuse tokio::io;\nuse url::Url;\n\n/// Default per-request body size cap. Matches the server's default\n/// `--max-http-request-size` so a `write` command piped from a generator\n/// that produces a stream larger than 10 MiB still succeeds out of the box.\nconst DEFAULT_MAX_REQUEST_SIZE: usize = 10 * 1024 * 1024;\n\n/// Size of each blocking `read()` from the input source (file / stdin).\nconst READ_SIZE: usize = 4 * 1024 * 1024;\n\n#[derive(Debug, thiserror::Error)]\npub enum Error {\n    #[error(transparent)]\n    Client(#[from] influxdb3_client::Error),\n\n    #[error(\"error reading file: {0}\")]\n    Io(#[from] io::Error),\n\n    #[error(\"No input from stdin detected, no string was passed in, and no file path was given\")]\n    NoInput,\n\n    #[error(\"no line protocol string provided\")]\n    NoLine,\n\n    #[error(\n        \"ensure that a single protocol line string is provided as the final \\\n        argument, enclosed in quotes\"\n    )]\n    MoreThanOne,\n}\n\npub type Result<T> = std::result::Result<T, Error>;\n\n#[derive(Debug, Parser)]","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_commands/src/write.rs#L17-L53","documentation":"The influxdb3 `write` command wraps I/O failures when reading a file (`--file <path>`) or stdin as `Io(#[from] io::Error)`, rendered as \"error reading file: {0}\". It indicates the underlying std::io::Error while reading the line protocol input file.","triggerScenarios":"`influxdb3 write --file <path>` where the path does not exist, lacks read permission, or is a directory; stdin read failure.","commonSituations":"Typo in file path; running from a different working directory than expected; file removed between command construction and execution; permission changes after deployment.","solutions":["Verify the file path is correct and exists (`ls -l <path>`)","Check read permissions on the file","Use an absolute path to avoid working-directory confusion"],"exampleFix":"// before\ninfluxdb3 write --file ./lp/lineproto.txt --database my-db\n// after\ninfluxdb3 write --file /abs/path/lp/lineproto.txt --database my-db  # after confirming file exists","handlingStrategy":"validation","validationCode":"// shell guard before invoking the CLI\nFILE=./lp/lineproto.txt\nif [[ ! -f \"$FILE\" || ! -r \"$FILE\" ]]; then\n  echo \"file missing or unreadable: $FILE\" >&2; exit 1\nfi","typeGuard":null,"tryCatchPattern":"// match the wrapped io::Error kind\nmatch err {\n    Error::Io(io) => eprintln!(\"check path/permissions: {io}\"),\n    _ => return Err(err),\n}","preventionTips":["Use absolute paths in scripts","Verify file existence and permissions before running","Avoid deleting input files while jobs run"],"tags":["io","file","cli","read"],"backgroundTag":"file-read-failed","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}