denoland/deno · error · Error
Cannot get cursor before first iteration
Error message
Cannot get cursor before first iteration
What it means
Error "Cannot get cursor before first iteration" thrown in denoland/deno.
Source
Thrown at ext/kv/01_db.ts:904
this.#selector = { start, end };
} else {
throw new TypeError(
"Selector must specify either 'prefix' or both 'start' and 'end' key",
);
}
}
ObjectFreeze(this.#selector);
this.#pullBatch = pullBatch;
this.#limit = limit;
this.#reverse = reverse;
this.#consistency = consistency;
this.#batchSize = batchSize;
this.#cursorGen = cursor ? () => cursor : null;
}
get cursor(): string {
if (this.#cursorGen === null) {
throw new Error("Cannot get cursor before first iteration");
}
return this.#cursorGen();
}
async next(): Promise<IteratorResult<Deno.KvEntry<unknown>>> {
// Fused or limit exceeded
if (
this.#done ||
(this.#limit !== undefined && this.#count >= this.#limit)
) {
return { done: true, value: undefined };
}
// Attempt to fill the buffer
if (!this.#entries?.length && !this.#lastBatch) {
const batch = await this.#pullBatch(
this.#selector,View on GitHub (pinned to 89f33cbef2)
When it happens
Trigger: Thrown at ext/kv/01_db.ts:904 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of denoland/deno@89f33cbef2 (2026-08-16).
Data as JSON: /api/errors/95f7a2fc2b9d5fe6.
Report an issue: GitHub.