Title: sqlite: exhausted iterators incorrectly receive `return()` · Issue #66518 · nodejs/node · GitHub
Open Graph Title: sqlite: exhausted iterators incorrectly receive `return()` · Issue #66518 · nodejs/node
X Title: sqlite: exhausted iterators incorrectly receive `return()` · Issue #66518 · nodejs/node
Description: 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() {...
Open Graph Description: 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: [{ nam...
X Description: 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...
Opengraph URL: https://github.com/nodejs/node/issues/66518
X: @github
Domain: github.com
IPv4 address: 140.82.113.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"sqlite: exhausted iterators incorrectly receive `return()`","articleBody":"### Version\n\nmain\n\n### Platform\n\n```text\nAll\n```\n\n### Subsystem\n\nsqlite\n\n### What steps will reproduce the bug?\n\n```js\nimport { Database } from 'node:sqlite';\nconst db = new Database(':memory:');\n\ndb.createModule('empty', {\n columns: [{ name: 'value', type: 'INTEGER' }],\n rows() {\n return {\n [Symbol.iterator]() { return this; },\n next() { return { value: [], done: true }; }, // empty: exhausted immediately\n return() { throw new Error('cleanup boom'); },\n };\n },\n});\n\nconsole.log(db.prepare('SELECT value FROM empty').all());\n```\n\n### How often does it reproduce? Is there a required condition?\n\nAlways\n\n### What is the expected behavior? Why is that the expected behavior?\n\nOnce `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 `[]`.\n\n### What do you see instead?\n\nthrows `Error: cleanup boom` from the custom iterator's `return()` even though the iterable is empty and was exhausted normally.\n\n### Additional information\n\n_No response_","author":{"url":"https://github.com/trivikr","@type":"Person","name":"trivikr"},"datePublished":"2026-10-05T00:59:44Z","url":"https://github.com/nodejs/node/issues/66518"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:5e9aee30-8ed3-14e6-be0a-a9b32d002d55 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DF3A:D5B7F:2B3707E:392100D:6B033630 |
| html-safe-nonce | d9717ea2cbc7fe969c38b29276a69037743fa0f6b7630f5f40f4cf02bdd9a02b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERjNBOkQ1QjdGOjJCMzcwN0U6MzkyMTAwRDo2QjAzMzYzMCIsInZpc2l0b3JfaWQiOiI1MjkxMTUxMTY5Mjk5ODg3NjY0IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 55b06d2dd4e191bf53743211bd718e67a51cde1ccabfbba4f5dd95d252fa35e0 |
| hovercard-subject-tag | issue:5704912616 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/66518/issue_layout |
| twitter:image | https://opengraph.githubassets.com/433e3c22a8669d6d6d348b78198c6d902269a8108a0d5070db688da4349760d1/nodejs/node/issues/66518 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/433e3c22a8669d6d6d348b78198c6d902269a8108a0d5070db688da4349760d1/nodejs/node/issues/66518 |
| og:image:alt | 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: [{ nam... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | trivikr |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width