paperclipai/paperclip · error
${name} must be a positive integer, got: ${env[name]}
Error message
${name} must be a positive integer, got: ${env[name]} What it means
Environment-variable parsing guard in the DB client bootstrap: a numeric env var (pool size, idle/connect timeout) was set to something that is not a positive integer, so the driver option cannot be derived and startup aborts naming the variable and its raw value.
Source
Thrown at packages/db/src/client.ts:84
clientFinalizer.register(client, { hostPortKey: key, ref }, ref);
}
/**
* Ends every live client `createDb` handed out for the given URL's host and
* port, then forgets them. Call this before stopping a Postgres cluster: a
* client that outlives the cluster it points at can crash the process (a
* reserved connection's deferred write firing after the socket is gone).
* Swallows individual `end()` errors so one bad client cannot block the rest.
*/
export async function closeRegisteredClients(url: string): Promise<void> {
const key = hostPortKey(url);
const refs = clientsByHostPort.get(key);
if (!refs) return;
clientsByHostPort.delete(key);
const clients: RegisteredPostgresClient[] = [];
for (const ref of refs) {
clientFinalizer.unregister(ref);
const client = ref.deref();
if (client) clients.push(client);
}
await Promise.all(clients.map((client) => client.end({ timeout: 1 }).catch(() => {})));
}
function isSafeIdentifier(value: string): boolean {
return /^[A-Za-z_][A-Za-z0-9_]*$/.test(value);
}
function quoteIdentifier(value: string): string {
if (!isSafeIdentifier(value)) throw new Error(`Unsafe SQL identifier: ${value}`);
return `"${value.replaceAll("\"", "\"\"")}"`;
}
function quoteLiteral(value: string): string {
return `'${value.replaceAll("'", "''")}'`;View on GitHub (pinned to 01ad858492)
Solutions
- Set ${name} to a positive integer.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/db/src/client.ts:77 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-08-18).
Data as JSON: /api/errors/2168bcac252ed35a.
Report an issue: GitHub.