warpdotdev/warp · error

jq filter error: {err}

Error message

jq filter error: {err}

What it means

The jq filter parsed successfully but failed at runtime against actual input values (jaq's result callback): indexing into a scalar or null, calling a function on the wrong type, or arithmetic on strings. The filter is syntactically valid — the input shape does not match what it assumes.

Source

Thrown at app/src/ai/agent_sdk/output.rs:220

        color_err: false,
        writer: Writer {
            format: Format::Json,
            pp: pretty_pp(),
            join: false,
        },
    };

    jaq_all::data::run(
        &runner,
        jq_filter,
        Default::default(),
        [input_result].into_iter(),
        // Callback to format invalid input errors.
        |err| anyhow::anyhow!("Invalid data: {err}"),
        // Callback to handle filter outputs.
        |result| match result {
            Ok(val) => write_filter_output(&val, out),
            Err(err) => anyhow::bail!("jq filter error: {err}"),
        },
    )?;

    Ok(())
}

/// Pretty-printer configuration used for non-scalar filter output. Matches
/// `serde_json`'s pretty printer: two-space indent, space after `:`, no
/// trailing space after `,` (since commas sit at end-of-line).
fn pretty_pp() -> jaq_write::Pp {
    jaq_write::Pp {
        indent: Some("  ".to_string()),
        sep_space: true,
        ..jaq_write::Pp::default()
    }
}

/// Write a single filter output, unwrapping top-level scalars to raw text.

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Make the filter defensive: optional access (.config.name?), // alternatives, or try/catch
  2. Inspect the unfiltered output to learn the actual shapes
  3. Pin the filter to fields present on every row, or project with map(.id?)
  4. Rehearse the filter with jq locally against a saved sample before scripting it

Example fix

# before
warp runner list --jq '.[].config.name'

# after
warp runner list --jq '[.[] | .config.name? // "(unnamed)"]'
Defensive patterns

Strategy: validation

Validate before calling

# Rehearse the filter against a saved sample before using it in scripts
warp runner list > /tmp/sample.json 2>/dev/null
jq '[.[] | .config.name? // "(unnamed)"]' /tmp/sample.json >/dev/null && echo filter-ok

Type guard

.config as $c | ($c | type) == "object" and ($c | has("name"))

Try / catch

out=$(warp runner list --jq '.[].config.name' 2>&1) || { case "$out" in *'jq filter error:'*) warp runner list --jq '[.[] | .config.name?]';; *) echo "$out" >&2; exit 1;; esac; }

Prevention

When it happens

Trigger: A filter like `.config.name` where some input rows lack `config` or carry a non-object there; `.foo[0]` when `.foo` is null; heterogeneous list output where fields are optional per row.

Common situations: Filters tested on one sample row then run over the full list; optional fields present on some objects only; schema changes between CLI versions adding/removing keys.

Related errors


AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16). Data as JSON: /api/errors/649c9521edbe07b7. Report an issue: GitHub.