{"record":{"id":"2168bcac252ed35a","repo":"paperclipai/paperclip","slug":"name-must-be-a-positive-integer-got-env-nam","errorCode":null,"errorMessage":"${name} must be a positive integer, got: ${env[name]}","messagePattern":"(.+?) must be a positive integer, got: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/db/src/client.ts","lineNumber":84,"sourceCode":"  clientFinalizer.register(client, { hostPortKey: key, ref }, ref);\n}\n\n/**\n * Ends every live client `createDb` handed out for the given URL's host and\n * port, then forgets them. Call this before stopping a Postgres cluster: a\n * client that outlives the cluster it points at can crash the process (a\n * reserved connection's deferred write firing after the socket is gone).\n * Swallows individual `end()` errors so one bad client cannot block the rest.\n */\nexport async function closeRegisteredClients(url: string): Promise<void> {\n  const key = hostPortKey(url);\n  const refs = clientsByHostPort.get(key);\n  if (!refs) return;\n\n  clientsByHostPort.delete(key);\n  const clients: RegisteredPostgresClient[] = [];\n  for (const ref of refs) {\n    clientFinalizer.unregister(ref);\n    const client = ref.deref();\n    if (client) clients.push(client);\n  }\n\n  await Promise.all(clients.map((client) => client.end({ timeout: 1 }).catch(() => {})));\n}\n\nfunction isSafeIdentifier(value: string): boolean {\n  return /^[A-Za-z_][A-Za-z0-9_]*$/.test(value);\n}\n\nfunction quoteIdentifier(value: string): string {\n  if (!isSafeIdentifier(value)) throw new Error(`Unsafe SQL identifier: ${value}`);\n  return `\"${value.replaceAll(\"\\\"\", \"\\\"\\\"\")}\"`;\n}\n\nfunction quoteLiteral(value: string): string {\n  return `'${value.replaceAll(\"'\", \"''\")}'`;","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/db/src/client.ts#L66-L102","documentation":"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.","triggerScenarios":"Thrown at packages/db/src/client.ts:77 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set ${name} to a positive integer."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}