quickwit-oss/quickwit · error

num_outputs must be at least 1

Error message

num_outputs must be at least 1

What it means

MergeConfig.num_outputs controls how many output files the streaming merge produces; a value of 0 is meaningless (at least one output or none at all is expected via a different path), so the merger rejects it up front. Valid configurations use num_outputs >= 1.

Source

Thrown at quickwit/quickwit-parquet-engine/src/merge/streaming.rs:157

pub(crate) fn record_body_col_page_cache_len(_len: usize) {}

/// Streaming N-input → M-output column-major merge.
///
/// See module docs for the four phases. Returns one
/// [`MergeOutputFile`] per output file produced (zero-row outputs are
/// dropped). Caller's `config.num_outputs` is the upper bound on the
/// number of files; fewer are returned when there are not enough
/// `sorted_series` transitions to split at.
pub async fn streaming_merge_sorted_parquet_files(
    inputs: Vec<Box<dyn ColumnPageStream>>,
    output_dir: &Path,
    config: &MergeConfig,
) -> Result<Vec<MergeOutputFile>> {
    if inputs.is_empty() {
        bail!("merge requires at least one input");
    }
    if config.num_outputs == 0 {
        bail!("num_outputs must be at least 1");
    }

    let input_meta = extract_and_validate_input_metadata(&inputs)?;

    // Reject legacy multi-RG inputs (`rg_partition_prefix_len == 0`
    // AND any input has >1 row group). These have no alignment claim,
    // so RG boundaries are arbitrary row counts that may split a
    // single sort-key value across two RGs. The streaming engine
    // cannot determine merge regions without column-chunk-bounded
    // buffering; such inputs must go through `LegacyInputAdapter`
    // (from PR-5, see `storage::legacy_adapter`), which presents
    // them as one synthetic single-RG stream.
    //
    // This guard catches caller bugs — production code always routes
    // legacy splits through the adapter (see `merge::execute_merge_operation`
    // in `merge/mod.rs`), so a raw legacy `StreamingParquetReader`
    // arriving here is a wiring mistake, not a supported input shape.
    // Bail with a clear pointer rather than wading further into the

View on GitHub (pinned to a39730c5cd)

Solutions

  1. Set config.num_outputs to at least 1 before invoking the merge.
  2. Fix MergeConfig construction/deserialization to default num_outputs to 1 instead of 0.
  3. If zero outputs is the intent, skip the merge call entirely rather than passing num_outputs = 0.

Example fix

// before
let config = MergeConfig { num_outputs: 0, ..Default::default() };
// after
let config = MergeConfig { num_outputs: 1, ..Default::default() };
Defensive patterns

Strategy: validation

Validate before calling

anyhow::ensure!(config.num_outputs >= 1, "MergeConfig.num_outputs must be >= 1 before merging");

Try / catch

match streaming_merge_sorted_parquet_files(streams, &out, &cfg).await {
    Err(e) if e.to_string().contains("num_outputs must be at least 1") => {
        let cfg = MergeConfig { num_outputs: 1, ..cfg.clone() };
        streaming_merge_sorted_parquet_files(streams, &out, &cfg).await
    }
    other => other,
}

Prevention

When it happens

Trigger: Calling streaming_merge_sorted_parquet_files with a MergeConfig where num_outputs == 0, typically from a default-built or partially initialized MergeConfig.

Common situations: Config parsing that leaves num_outputs unset (defaulting to 0); a caller computing num_outputs from a formula that returns 0 when no outputs were requested.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08). Data as JSON: /api/errors/117d97bd50d63a2f. Report an issue: GitHub.