{"record":{"id":"90f0d0da23fd3342","repo":"warpdotdev/warp","slug":"invalid-data-err","errorCode":null,"errorMessage":"Invalid data: {err}","messagePattern":"Invalid data: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/ai/agent_sdk/output.rs","lineNumber":216,"sourceCode":"    let input_result = serde_json::from_value::<Val>(value);\n\n    let runner = Runner {\n        null_input: false,\n        color_err: false,\n        writer: Writer {\n            format: Format::Json,\n            pp: pretty_pp(),\n            join: false,\n        },\n    };\n\n    jaq_all::data::run(\n        &runner,\n        jq_filter,\n        Default::default(),\n        [input_result].into_iter(),\n        // Callback to format invalid input errors.\n        |err| anyhow::anyhow!(\"Invalid data: {err}\"),\n        // Callback to handle filter outputs.\n        |result| match result {\n            Ok(val) => write_filter_output(&val, out),\n            Err(err) => anyhow::bail!(\"jq filter error: {err}\"),\n        },\n    )?;\n\n    Ok(())\n}\n\n/// Pretty-printer configuration used for non-scalar filter output. Matches\n/// `serde_json`'s pretty printer: two-space indent, space after `:`, no\n/// trailing space after `,` (since commas sit at end-of-line).\nfn pretty_pp() -> jaq_write::Pp {\n    jaq_write::Pp {\n        indent: Some(\"  \".to_string()),\n        sep_space: true,\n        ..jaq_write::Pp::default()","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/output.rs#L198-L234","documentation":"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).","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nwarp task list --jq '.[0].id' 2>&1 | tail -n 1   # stderr pollutes JSON\n\n# after\nwarp task list --jq '.[0].id' 2>/dev/null","handlingStrategy":"validation","validationCode":"# Validate the payload is JSON before applying any filter\nraw=$(warp task list 2>/dev/null) || { echo 'command failed; skipping filter' >&2; exit 1; }\nprintf '%s' \"$raw\" | jq empty 2>/dev/null || { echo 'output is not JSON' >&2; exit 1; }\nprintf '%s' \"$raw\" | jq '.[0].id'","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["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"],"tags":["jq","json","parsing","output"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}