influxdata/influxdb · error · Error::Io

error reading file

Error message

error reading file: {0}

What it means

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.

Solutions

  1. Verify the file path is correct and exists (`ls -l <path>`)
  2. Check read permissions on the file
  3. Use an absolute path to avoid working-directory confusion

Example fix

// before
influxdb3 write --file ./lp/lineproto.txt --database my-db
// after
influxdb3 write --file /abs/path/lp/lineproto.txt --database my-db  # after confirming file exists
Defensive patterns

Strategy: validation

Validate before calling

// shell guard before invoking the CLI
FILE=./lp/lineproto.txt
if [[ ! -f "$FILE" || ! -r "$FILE" ]]; then
  echo "file missing or unreadable: $FILE" >&2; exit 1
fi

Try / catch

// match the wrapped io::Error kind
match err {
    Error::Io(io) => eprintln!("check path/permissions: {io}"),
    _ => return Err(err),
}

Prevention

When it happens

Trigger: `influxdb3 write --file <path>` where the path does not exist, lacks read permission, or is a directory; stdin read failure.

Common situations: Typo in file path; running from a different working directory than expected; file removed between command construction and execution; permission changes after deployment.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/91e79b53146c5551. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_commands/src/write.rs:35

    time::{Duration, Instant},
};
use tokio::io;
use url::Url;

/// Default per-request body size cap. Matches the server's default
/// `--max-http-request-size` so a `write` command piped from a generator
/// that produces a stream larger than 10 MiB still succeeds out of the box.
const DEFAULT_MAX_REQUEST_SIZE: usize = 10 * 1024 * 1024;

/// Size of each blocking `read()` from the input source (file / stdin).
const READ_SIZE: usize = 4 * 1024 * 1024;

#[derive(Debug, thiserror::Error)]
pub enum Error {
    #[error(transparent)]
    Client(#[from] influxdb3_client::Error),

    #[error("error reading file: {0}")]
    Io(#[from] io::Error),

    #[error("No input from stdin detected, no string was passed in, and no file path was given")]
    NoInput,

    #[error("no line protocol string provided")]
    NoLine,

    #[error(
        "ensure that a single protocol line string is provided as the final \
        argument, enclosed in quotes"
    )]
    MoreThanOne,
}

pub type Result<T> = std::result::Result<T, Error>;

#[derive(Debug, Parser)]

View on GitHub (pinned to 06200ef96b)