Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

[BUG]: Parameter count higher than 16bit gets dropped silently

Open Beginner friendly
#1,118 0 comments 0 reactions 0 assignees View on GitHub

@Aquiko is already working on this.

Since Oct 8, 2026.

  • #1123 by @Aquiko — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
postgresql, typescript, wasm
Domain
databases

Research direction

Start in packages/pg-protocol/src/buffer-reader.ts at int16() (getInt16 vs unsigned 16-bit protocol counts) and how parser.ts uses it for ParameterDescription. Reproduce with the multi-row insert of 32768 parameters in the issue; n=32767 should still work. Done when that insert reports the right affectedRows, later queries still work, and the instance is not left unusable.

Written by the indexing model from the issue text.

Description

bug

Describe the bug

A query binding more than 32767 parameters is silently dropped. query() resolves
with affectedRows: 0 and rows: [], no error is thrown, and the instance is left
unusable, every later query resolves with empty results too.

The real limit is 65535 parameters (Postgres's own limit); 32768–65535 work fine
against a real Postgres server through pg. PGlite fails at 32768.

To Reproduce

import { PGlite } from "@electric-sql/pglite";

const db = await PGlite.create();
await db.exec('create table "t" ("a" text)');

const n = 32768;
const tuples = Array.from({ length: n }, (_, i) => `($${i + 1}::text)`);
const values = Array.from({ length: n }, (_, i) => `v${i}`);

// resolves, no throw
const result = await db.query(`insert into "t" ("a") values ${tuples.join(", ")}`, values);
console.log(result.affectedRows); // 0, expected 32768

// the instance is now dead: resolves with [] instead of [ { one: 1 } ]
console.log(await db.query("select 1 as one"));

n = 32767 works; n = 32768 is the first failure. 32 parameters per row means this
is a ~1024-row multi-row insert, which is easy to reach for bulk inserts.

Logs

n=32767 -> affectedRows=32767 | next: [ { one: 1 } ]
n=32768 -> affectedRows=0     | next: []
n=32769 -> affectedRows=0     | next: []

With new PGlite({ debug: 5 }) the failing statement produces no Postgres ERROR
or FATAL in the log at all.

Details

  • PGlite version: 0.5.8 (also present on main, d9eadc63)
  • Extensions: none
  • OS: Fedora Linux 44 (Workstation), x86_64
  • Node: v24.18.0

Additional context

This fix may contain hallucinations, but I think it could be correct:

Fix: int16() in packages/pg-protocol/src/buffer-reader.ts should use getUint16()
instead of getInt16(), since the protocol's 16-bit counts are unsigned. parser.ts
reads the ParameterDescription count with it and new Array(-32768) then throws, which
is what kills the instance.

Dominant language
TypeScript
Stars
16.1k
Forks
447
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from electric-sql/pglite

All issues in electric-sql/pglite

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.