denoland/deno · error · TypeError

Selector must specify either 'prefix' or both 'start' and 'e

Error message

Selector must specify either 'prefix' or both 'start' and 'end' key

What it means

Error "Selector must specify either 'prefix' or both 'start' and 'end' key" thrown in denoland/deno.

Source

Thrown at ext/kv/01_db.ts:888

    }
    if (prefix) {
      if (start && end) {
        throw new TypeError(
          "Selector can not specify both 'start' and 'end' key when specifying 'prefix'",
        );
      }
      if (start) {
        this.#selector = { prefix, start };
      } else if (end) {
        this.#selector = { prefix, end };
      } else {
        this.#selector = { prefix };
      }
    } else {
      if (start && end) {
        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");
    }

View on GitHub (pinned to 89f33cbef2)

When it happens

Trigger: Thrown at ext/kv/01_db.ts:888 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/e94de3ac58d94f3a. Report an issue: GitHub.