warpdotdev/warp · error
Invalid data: {err}
Error message
Invalid data: {err} What it means
When a jq filter is applied to command output, the input stream must be valid JSON; this error comes from jaq's invalid-input callback — the data fed to the filter failed to parse. It is an input problem, not a filter problem (compare the separate jq filter error).
Source
Thrown at app/src/ai/agent_sdk/output.rs:216
let input_result = serde_json::from_value::<Val>(value);
let runner = Runner {
null_input: false,
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()View on GitHub (pinned to e72fd7aacb)
Solutions
- Run the same command without --jq and inspect the raw output
- Ensure the underlying command succeeded (check exit code) before filtering
- Keep stderr out of the filtered stream (2>/dev/null) so only the JSON payload reaches the filter
- Fix the generating command so stdout carries pure JSON
Example fix
# before warp task list --jq '.[0].id' 2>&1 | tail -n 1 # stderr pollutes JSON # after warp task list --jq '.[0].id' 2>/dev/null
Defensive patterns
Strategy: validation
Validate before calling
# Validate the payload is JSON before applying any filter
raw=$(warp task list 2>/dev/null) || { echo 'command failed; skipping filter' >&2; exit 1; }
printf '%s' "$raw" | jq empty 2>/dev/null || { echo 'output is not JSON' >&2; exit 1; }
printf '%s' "$raw" | jq '.[0].id' Try / catch
out=$(warp task list --jq '.[0].id' 2>&1) || { case "$out" in *'Invalid data:'*) warp task list 2>/dev/null | jq '.[0].id';; *) echo "$out" >&2; exit 1;; esac; } Prevention
- Never merge stderr into stdout before jq filtering
- Check the upstream exit code before filtering its output
- Keep warnings/logs on stderr in your own commands
When it happens
Trigger: Combining --jq with output that is not valid JSON: warnings or log lines interleaved into stdout, an empty output stream, or a command that emits human-readable text (e.g. an error message) while the filter expects JSON.
Common situations: Merging stderr into stdout with 2>&1 before filtering; log noise printed ahead of the JSON payload; using --jq on a failed command's text output; upstream schema changes making output non-JSON.
Related errors
- jq filter error: {err}
- Expected JSON object with 'reviews' key
- SKILL.md missing frontmatter (no opening ---)
- SKILL.md missing frontmatter (no closing ---)
- schema_unavailable_or_invalid
AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16).
Data as JSON: /api/errors/90f0d0da23fd3342.
Report an issue: GitHub.