Common Issues and Solutions
Dan Lynch
Nov 17, 2025
This guide covers common issues you might encounter while using pgpm and how to fix them quickly.
Table of Contents
pnpm Policies
pnpm blocks dependency build scripts
Symptom:
text[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: esbuild@0.25.12
pnpm blocks unapproved dependency build scripts because they can run code on your machine during installation.
Solution: If your workspace has pnpm-policy.yaml, add esbuild: true under settings.allowBuilds, then run from the workspace root:
bashpnpm run policy && pnpm install
Run pnpm run policy:check to verify that the generated pnpm-workspace.yaml settings match the policy.
Without a policy, run pnpm approve-builds esbuild, then retry pnpm install.
Postgres Issues
Docker not running
Symptom:
textError: Docker is installed but the daemon is not running.
Solution:
Start Docker Desktop and ensure it's running before executing pgpm docker start.
Postgres not accepting connections
Symptom:
textpsql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed
Solution:
bash# Check if Postgres is running pgpm docker start # Load environment variables eval "$(pgpm env)" # Verify connection psql -c "SELECT version();"
Testing Issues
Tests fail to connect to database
Symptom: Tests time out or fail with connection errors
Solution: Ensure Postgres is running and users are bootstrapped:
bashpgpm docker start eval "$(pgpm env)" pgpm admin-users bootstrap
Or, if you're not running interactively (for example, as an agent):
bashpgpm admin-users bootstrap --yes
Current transaction is aborted in tests
Symptom:
When testing operations that should fail (RLS violations, permission errors, constraint violations), subsequent queries on the same connection fail with:
textcurrent transaction is aborted, commands ignored until end of transaction block
The Problem:
In Postgres, any error inside a transaction marks the entire transaction as aborted. After that, every further query on that connection fails until you explicitly end the transaction.
This is particularly painful in tests where you intentionally assert failures (e.g., expect(...).rejects.toThrow(...)) and then want to continue using the same db connection.
Solution: Use Savepoints
Wrap each "expected-to-fail" operation in a savepoint, and roll back to that savepoint after the failure. This clears the error state while keeping the surrounding transaction open.
Pattern:
typescriptconst point = 'some_savepoint'; await db.savepoint(point); await expect( db.query(/* statement that should fail */) ).rejects.toThrow(/permission denied/); await db.rollback(point); // ROLLBACK TO SAVEPOINT
Example: Anonymous users cannot modify data
typescriptit('anonymous users cannot modify any data', async () => { db.setContext({ role: 'anonymous' }); const insertPoint = 'anonymous_insert'; await db.savepoint(insertPoint); await expect( db.query(` INSERT INTO pets.pets (name, species, owner_id) VALUES ('Anonymous Pet', 'hamster', $1) `, [alice]) ).rejects.toThrow(/permission denied/); await db.rollback(insertPoint); const updatePoint = 'anonymous_update'; await db.savepoint(updatePoint); await expect( db.query(`UPDATE pets.pets SET name = 'Hacked'`) ).rejects.toThrow(/permission denied/); await db.rollback(updatePoint); const deletePoint = 'anonymous_delete'; await db.savepoint(deletePoint); await expect( db.query(`DELETE FROM pets.pets`) ).rejects.toThrow(/permission denied/); await db.rollback(deletePoint); });
By using savepoints + rollback, you can:
- Assert failures safely
- Keep using the same
dbtransaction - Avoid
current transaction is abortederrors entirely
For more details, see Advanced: Handling Exceptions and Aborted Transactions.
Environment Variable Issues
Environment variables not set
Symptom: Commands fail with "PGHOST not set" or similar
Solution: Load pgpm environment:
basheval "$(pgpm env)"
To make permanent, add to your shell config:
bash# Add to ~/.bashrc or ~/.zshrc eval "$(pgpm env)"

