quickwit-oss/quickwit · error
could not serialize JsonValue
Error message
could not serialize JsonValue
What it means
While building a SearchRequest from the REST search endpoint, `serde_json::to_string` failed to serialize the parsed query AST (a JsonValue-based structure) into the request's query_ast JSON string. Serialization of a JSON value failing here indicates a non-string map key or similar structurally invalid JSON produced upstream, and the error propagates as a SearchError via `?`.
Source
Thrown at quickwit/quickwit-serve/src/search_api/rest_handler.rs:262
index_id_patterns: Vec<String>,
search_request: SearchRequestQueryString,
) -> Result<quickwit_proto::search::SearchRequest, SearchError> {
// The query ast below may still contain user input query. The actual
// parsing of the user query will happen in the root service, and might require
// the user of the docmapper default fields (which we do not have at this point).
let query_ast = query_ast_from_user_text(&search_request.query, search_request.search_fields);
let query_ast_json = serde_json::to_string(&query_ast)?;
let search_request = quickwit_proto::search::SearchRequest {
index_id_patterns,
query_ast: query_ast_json,
snippet_fields: search_request.snippet_fields.unwrap_or_default(),
start_timestamp: search_request.start_timestamp,
end_timestamp: search_request.end_timestamp,
max_hits: search_request.max_hits,
start_offset: search_request.start_offset,
aggregation_request: search_request
.aggs
.map(|agg| serde_json::to_string(&agg).expect("could not serialize JsonValue")),
sort_fields: search_request.sort_by.sort_fields,
scroll_ttl_secs: None,
search_after: None,
count_hits: search_request.count_all.into(),
ignore_missing_indexes: false,
skip_aggregation_finalization: false,
..Default::default()
};
Ok(search_request)
}
async fn search_endpoint(
index_id_patterns: Vec<String>,
search_request: SearchRequestQueryString,
search_service: &dyn SearchService,
) -> Result<SearchResponseRest, SearchError> {
let allow_failed_splits = search_request.allow_failed_splits;
let search_request = search_request_from_api_request(index_id_patterns, search_request)?;View on GitHub (pinned to a39730c5cd)
Solutions
- Simplify or correct the query/search_fields so the query AST is plain JSON with string keys
- Check for unusual characters or malformed query syntax in the search request
- Report the failing request shape to Quickwit maintainers if it looks valid
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at quickwit/quickwit-serve/src/search_api/rest_handler.rs:262 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of quickwit-oss/quickwit@a39730c5cd (2026-09-08).
Data as JSON: /api/errors/cda7f64d5707fa19.
Report an issue: GitHub.