GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sqlite: exhausted iterators incorrectly receive `return()` · Issue #66518 · nodejs/node

sqlite: exhausted iterators incorrectly receive return() #66518

New issue
Copy link
New issue
Copy link
Closed
#66519
Closed
sqlite: exhausted iterators incorrectly receive return()#66518
#66519
Copy link
Assignees
trivikr
Labels
sqliteIssues and PRs related to the SQLite subsystem.

Description

@trivikr
trivikr
opened on Oct 5, 2026
Issue body actions

Version

main

Platform

All

Subsystem

sqlite

What steps will reproduce the bug?

import { Database } from 'node:sqlite';
const db = new Database(':memory:');

db.createModule('empty', {
  columns: [{ name: 'value', type: 'INTEGER' }],
  rows() {
    return {
      [Symbol.iterator]() { return this; },
      next() { return { value: [], done: true }; }, // empty: exhausted immediately
      return() { throw new Error('cleanup boom'); },
    };
  },
});

console.log(db.prepare('SELECT value FROM empty').all());

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

Once next() reports done: true, the iterator is finished and return() must be skipped, matching for...of semantics where return() is only called on abrupt termination; the query should return [].

What do you see instead?

throws Error: cleanup boom from the custom iterator's return() even though the iterable is empty and was exhausted normally.

Additional information

No response

Activity

  1. trivikr
    self-assigned this
    on Oct 5, 2026
  2. trivikr
    added
    sqliteIssues and PRs related to the SQLite subsystem.
    on Oct 5, 2026
  3. nodejs-github-bot
    closed this as completedin #66519on Oct 25, 2026
  4. nodejs-github-bot
    added a commit that references this issue on Oct 25, 2026

    sqlite: skip return() on exhausted virtual table iterators

    cfb2de3
  5. aduh95
    added a commit that references this issue on Nov 12, 2026

    sqlite: skip return() on exhausted virtual table iterators

    fbbacb9
  6. gabylb
    added a commit that references this issue on Nov 27, 2026

    sqlite: skip return() on exhausted virtual table iterators

    08c0bda
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @trivikr
    trivikr

Labels

sqliteIssues and PRs related to the SQLite subsystem.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.