linera-io/linera-protocol · error

--output specified but resolved to no entries

Error message

--output specified but resolved to no entries

What it means

--output was supplied but parsing it yielded zero usable entries. parse_all skips empty/blank segments while collecting FORMAT:TARGET specs; if every segment was skipped (or the value was empty), the flag is considered misconfigured and fails rather than silently writing nothing.

Source

Thrown at linera-service/src/cli/validator_benchmark/report.rs:59

    pub fn parse_all(raw: &[String]) -> Result<Vec<OutputSpec>> {
        if raw.is_empty() {
            return Ok(vec![OutputSpec {
                format: Format::Md,
                target: Target::Stdout,
            }]);
        }
        let mut out = Vec::new();
        for item in raw {
            for part in item.split([',', '+']) {
                let part = part.trim();
                if part.is_empty() {
                    continue;
                }
                out.push(Self::parse_one(part)?);
            }
        }
        if out.is_empty() {
            return Err(anyhow!("--output specified but resolved to no entries"));
        }
        Ok(out)
    }

    fn parse_one(s: &str) -> Result<OutputSpec> {
        let (fmt_str, target) = match s.split_once(':') {
            Some((f, p)) => (f, Target::File(PathBuf::from(p))),
            None => (s, Target::Stdout),
        };
        let format = match fmt_str {
            "json" => Format::Json,
            "yaml" => Format::Yaml,
            "md" => Format::Md,
            "brief" => Format::Brief,
            other => {
                return Err(anyhow!(
                    "unknown output format `{other}` (expected json|yaml|md|brief)"
                ))

View on GitHub (pinned to 6c226ddcb3)

Solutions

  1. Provide at least one format:target spec, e.g. `--output json:report.json`.
  2. Echo the argument just before invoking the tool to catch empty shell variables.
  3. Strip trailing separators/whitespace when composing the value programmatically.
  4. Drop the flag entirely if no report file is wanted.

Example fix

# before: empty value resolves to no entries
--output ""            # or: --output "${OUTPUT_SPEC}" with OUTPUT_SPEC unset

# after: at least one FORMAT:TARGET entry
--output json:report.json
Defensive patterns

Strategy: validation

Validate before calling

let entries: Vec<&str> = arg
    .split(',')
    .map(str::trim)
    .filter(|s| !s.is_empty())
    .collect();
ensure!(!entries.is_empty(), "--output needs at least one FORMAT:TARGET entry");

Prevention

When it happens

Trigger: `--output ""`, a value made only of separators/whitespace, or shell quoting that expands to an empty string (e.g. an unset variable inside quotes).

Common situations: Scripts passing $OUTPUT_SPEC without a default; YAML/CI templates with an empty output field; trailing separators after a deleted entry.

Related errors


AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22). Data as JSON: /api/errors/11ae7d5a1d3fcb19. Report an issue: GitHub.