influxdata/influxdb · error · Error::MoreThanOne

ensure that a single protocol line string is provided as…

Error message

ensure that a single protocol line string is provided as the final argument, enclosed in quotes

What it means

The influxdb3 `write` command's `MoreThanOne` variant fires when more than one positional argument is given. The command accepts exactly one line protocol string as the final argument, so extra arguments are ambiguous.

Solutions

  1. Enclose the whole LP string in single quotes so it is one argument
  2. Move multiple lines into a file and use `--file <path>`
  3. Pipe multiple lines via stdin

Example fix

// before
influxdb3 write --database my-db cpu,host=a usage=0.5
// after
influxdb3 write --database my-db 'cpu,host=a usage=0.5'
Defensive patterns

Strategy: validation

Validate before calling

// shell guard
if (( $# > 1 )); then
  echo "pass exactly one quoted line protocol string; use --file for multiple lines" >&2; exit 1
fi

Prevention

When it happens

Trigger: Running `influxdb3 write --database db 'm1 v=1' 'm2 v=2'` or an unquoted LP string whose spaces split it into multiple shell words.

Common situations: Forgetting quotes around line protocol containing spaces; passing multiple LP lines expecting batching (must use a file or stdin instead).

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at influxdb3_commands/src/write.rs:44

/// 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)]
#[clap(visible_alias = "w", trailing_var_arg = true)]
pub struct Config {
    /// Common InfluxDB 3 server config
    #[clap(flatten)]
    influxdb3_config: InfluxDb3Config,

    /// Override host URL for write operations
    #[clap(long = "write-host", env = "INFLUXDB3_WRITE_HOST_URL")]
    write_host_url: Option<Url>,

View on GitHub (pinned to 06200ef96b)