can1357/oh-my-pi · error · SeqError
invalid {} argument: {}
Error message
invalid {} argument: {} What it means
`SeqError::ParseError` from the seq builtin: an operand string could not be parsed as a number. The message is 'invalid {type} argument: {arg}' where the type comes from `parse_error_type(.1)` (e.g. floating-point vs integer) and the offending argument is quoted. It exists so the CLI can report exactly which command-line argument was malformed and why.
Source
Thrown at crates/pi-builtins/src/seq.rs:433
mod error {
//! Errors returned by seq.
// pi-uutils: `translate!` message lookups are literalized with the en-US
// strings from upstream's locales/en-US.ftl.
use thiserror::Error;
use uucore::display::Quotable;
use super::numberparse::ParseNumberError;
#[derive(Debug, Error)]
pub enum SeqError {
/// An error parsing the input arguments.
///
/// The parameters are the [`String`] argument as read from the
/// command line and the underlying parsing error itself.
#[error("invalid {} argument: {}", parse_error_type(.1), .0.quote())]
ParseError(String, ParseNumberError),
/// The increment argument was zero, which is not allowed.
///
/// The parameter is the increment argument as a [`String`] as read
/// from the command line.
#[error("invalid Zero increment value: {}", .0.quote())]
ZeroIncrement(String),
/// No arguments were passed to this function, 1 or more is required
#[error("missing operand")]
NoArguments,
/// Both a format and equal width where passed to seq
#[error("format string may not be specified when printing equal width strings")]
FormatAndEqualWidth,
}
View on GitHub (pinned to 9690622007)
Solutions
- Inspect the quoted argument in the message and correct the typo so it is a plain integer or float depending on the seq form used.
- Check that shell variables used as operands are set and numeric (`echo "$START"`, or `${START:-0}`).
- Strip locale formatting: remove thousands separators and use '.' as the decimal separator.
- In code calling the seq API, parse/validate operands yourself first and reject non-numeric strings with your own error before invoking seq.
- Quote shell arguments to avoid word-splitting producing extra/empty operands (`seq "$start" "$end"`).
Example fix
// before: unset variable expands to an empty operand
seq $START $END # -> invalid floating-point argument: ''
// after: default and validate before use
: "${START:=1}"
seq "$START" "$END" Defensive patterns
Strategy: validation
Validate before calling
fn validate_seq_operand(arg: &str) -> Result<f64, String> {
let t = arg.trim();
if t.is_empty() {
return Err("seq operand is empty (unset variable?)".into());
}
t.parse::<f64>().map_err(|_| format!("invalid seq operand: {arg:?}"))
} Type guard
fn is_parse_error(err: &SeqError) -> bool {
matches!(err, SeqError::ParseError(_, _))
} Try / catch
match seq_result {
Err(SeqError::ParseError(arg, kind)) => {
eprintln!("seq: fix argument {arg} (expected a number: {kind:?})");
}
Err(e) => return Err(e.into()),
Ok(v) => Ok(v),
} Prevention
- Always quote shell operands (`seq "$start" "$end"`) to prevent word-splitting and empty arguments.
- Default or validate shell variables before use: `${START:=1}`.
- Use '.' as decimal separator and strip thousands separators / locale formatting.
- Pre-parse operands in calling code and reject non-numeric strings with your own error before invoking seq.
When it happens
Trigger: Calling seq (or the library's seq entry point) with a non-numeric operand, e.g. `seq abc`, `seq 1 xyz 10`, arguments with stray whitespace or thousands separators ('1 000'), trailing characters ('10f'), or an empty string as one of start/increment/end operands.
Common situations: Shell variables that are unset or empty expanding to nothing (`seq $START 10` with START unset); passing floats to the integer-only form or vice versa; locale-formatted numbers ('1,5'); copy-pasted arguments with hidden Unicode characters; typos like `seq 1..10`.
Related errors
- invalid Zero increment value: {}
- --agents must be a positive integer
- --trusted-extension requires a non-empty, non-flag value
- Invalid --state '${raw}'. Valid values: ${GALLERY_STATE_TOKE
- Invalid credential id: ${value}
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/a597839d78841bf3.
Report an issue: GitHub.