wasmerio/wasmer · error
The page is non-empty
Error message
The page is non-empty
What it means
In the backend-api GraphQL query paging logic, after filtering out messages from a fetched page, the code takes the last element with .expect("The page is non-empty") to advance the pagination cursor. The library assumes that whenever it reaches this branch the page returned at least one message; if the page is empty at this point the invariant is violated and it panics.
Source
Thrown at lib/backend-api/src/query.rs:2366
if page.is_empty() {
if watch {
/*
* [TODO]: The resolution here should be configurable.
*/
#[cfg(all(target_arch = "wasm32", target_os = "unknown"))]
std::thread::sleep(Duration::from_secs(1));
#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
tokio::time::sleep(Duration::from_secs(1)).await;
continue;
}
break Ok(None);
} else {
let last_message = page.last().expect("The page is non-empty");
let timestamp = last_message.timestamp;
// NOTE: adding 1 microsecond to the timestamp to avoid fetching
// the last message again.
let timestamp = OffsetDateTime::from_unix_timestamp_nanos(timestamp as i128)
.with_context(|| {
format!("Unable to interpret {timestamp} as a unix timestamp")
})?;
// FIXME: We need a better way to tell the backend "give me the
// next set of logs". Adding 1 nanosecond could theoretically
// mean we miss messages if multiple log messages arrived at
// the same nanosecond and the page ended midway.
let next_timestamp = timestamp + Duration::from_nanos(1_000);
break Ok(Some((page, next_timestamp)));
}
}View on GitHub (pinned to 8c4b9ee9d3)
Solutions
- Upgrade wasmer-backend / wasmer to a version with fixed pagination edge-case handling
- Check the channel data via the API directly; remove or repair the malformed message(s) that are being skipped
- Retry the query later if the API is returning transient inconsistent pages
- Work around by paginating manually with smaller page sizes so the filtered page is never fully empty
Example fix
// before
let last_message = page.last().expect("The page is non-empty");
// after
let last_message = match page.last() {
Some(m) => m,
None => break Ok(None),
}; Defensive patterns
Strategy: try-catch
Try / catch
// The panic occurs inside library query code; catch at the call boundary
let result = std::panic::catch_unwind(|| query_last_message(connector))
.map_err(|p| anyhow::anyhow!("last_message pagination panicked: {:?}", p))?; Prevention
- Keep wasmer-backend-api versions in sync with the server API schema
- Inspect channels with odd/all-filtered messages before querying last_message
- Retry queries on API inconsistencies and report reproducible panics upstream
- Validate API responses with smaller page sizes to expose empty-page cases early
When it happens
Trigger: Calling code that queries a chat/message channel's last_message via the paginated query when the API returns a page where every entry is filtered out by the preceding conditions (e.g. all messages fail validation or are skipped), leaving page empty at the .last() call.
Common situations: Using wasmer backend-api tooling against a channel with only malformed/skipped messages, or an API schema change that makes the filter drop all items in a page.
Related errors
- cron job '{cron_job}' not found
- invalid node type returned
- App deletion failed for an unknown reason
- No value found for secret with name '{}'
- not a `sys` backend!
AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01).
Data as JSON: /api/errors/ab5c719c5d6edb9b.
Report an issue: GitHub.