warpdotdev/warp · warning
--sort-by and --sort-order are not supported with JSON outpu
Error message
--sort-by and --sort-order are not supported with JSON output
What it means
ensure_json_sort_is_not_requested (app/src/ai/agent_sdk/agent_management.rs:335-347) rejects combining JSON output (--output-format json or forced JSON) with --sort-by or --sort-order, because the JSON path returns the server ordering verbatim while sorting is a client-side rendering concern for the non-JSON table. The check runs before any request is made.
Source
Thrown at app/src/ai/agent_sdk/agent_management.rs:345
fn request_is_empty(request: &UpdateAgentRequest) -> bool {
request.name.is_none()
&& request.description.is_none()
&& request.prompt.is_none()
&& request.secrets.is_none()
&& request.skills.is_none()
&& request.base_model.is_none()
&& request.environment_id.is_none()
}
fn ensure_json_sort_is_not_requested(
output_format: OutputFormat,
json_output: &JsonOutput,
args: &AgentListArgs,
) -> anyhow::Result<()> {
if (matches!(output_format, OutputFormat::Json) || json_output.force_json_output())
&& (args.sort_by.is_some() || args.sort_order.is_some())
{
return Err(anyhow!(
"--sort-by and --sort-order are not supported with JSON output"
));
}
Ok(())
}
fn sort_agents(
agents: &mut [AgentResponse],
sort_by: Option<AgentSortByArg>,
sort_order: Option<SortOrderArg>,
) {
let sort_by = sort_by.unwrap_or(AgentSortByArg::Name);
let default_order = match sort_by {
AgentSortByArg::Name => SortOrderArg::Asc,
AgentSortByArg::CreatedAt => SortOrderArg::Desc,
};
let sort_order = sort_order.unwrap_or(default_order);View on GitHub (pinned to e72fd7aacb)
Solutions
- Drop the sort flags and sort the JSON client-side, e.g. pipe through jq 'sort_by(.name)'
- Keep --sort-by/--sort-order and use the default (non-JSON) output where sorting is applied
Example fix
# before agents list --output-format json --sort-by name # after agents list --output-format json | jq 'sort_by(.name)'
Defensive patterns
Strategy: validation
Validate before calling
if (matches!(output_format, OutputFormat::Json) || json_output.force_json_output())
&& (args.sort_by.is_some() || args.sort_order.is_some())
{
// strip the sort flags (sort client-side after parsing the JSON) or switch to non-JSON output
} Prevention
- Sort JSON output in the consuming script (jq sort_by) rather than via CLI flags
- Reserve --sort-by/--sort-order for human-facing table output
When it happens
Trigger: Running agents list with --output-format json together with --sort-by and/or --sort-order.
Common situations: Scripts that always request sorted JSON; users switching an existing sorted invocation to JSON without dropping the sort flags.
Related errors
- schema_unavailable_or_invalid
- No updates requested
- Expected JSON object with 'reviews' key
- claude -p exited {result.returncode} stderr: {result.stderr}
- {role}_settings_unavailable_or_invalid
AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16).
Data as JSON: /api/errors/cfba1c6d9a8b7097.
Report an issue: GitHub.