Skip to content

Cannot connect from sql file using existing PSQL server profile #280

Description

@cbolik

Describe the bug

I have created a PSQL server connection in the PostgreSQL extension. It is connected and I can browse etc. the DB from here. However, when I open an existing sql file and click on the "Connect to PostgreSQL" magic link at the top of it, then select the existing known to be working connection profile, I get this error:

pgsql: Error: Connection error: connection failed: connection to server at "<INTERNAL_IP>", port 5432 failed: fe_sendauth: no password supplied

To Reproduce

Steps to reproduce the behavior:

  1. Create a PSQL connection profile using the PostgreSQL extension, ensure it connects fine
  2. Create a new sql file, populate it with some queries matching the DB's schema
  3. Click on the "Connect to PostgreSQL" link in that file, then select the connection profile created above
  4. Notice the connection fails with "no password supplied".

Expected behavior

I should be able to use the pre-existing connection profiles from any given sql file without error.

Screenshots

If applicable, add screenshots to help explain your problem.

VS Code version

Version: 1.128.0 (Universal)
Commit: fc3def6774c76082adf699d366f31a557ce5573f
Date: 2026-07-07T15:14:24-07:00
Electron: 42.5.0
ElectronBuildId: 14525058
Chromium: 148.0.7778.271
Node.js: 24.17.0
V8: 14.8.178.33-electron.0
OS: Darwin arm64 25.5.0

Extension Logs

[10:46:38] [PgToolsService Initialization] ServiceDownloadProvider initialized
[10:46:38] [PgToolsService Initialization] [All]: Initializing PostgreSQL Tools Service for the pgsql extension.
[10:46:38] [PgToolsService Initialization] [All]: Note: pgsql commands will be available after installing the service.
[10:46:38] [PgToolsService Initialization] [All]: 
[10:46:38] [PgToolsService Initialization] Platform: darwin, arm64[All]:  (OSX)
[10:46:38] [PgToolsService Initialization] [All]: 
[10:46:38] [PgToolsService Initialization] [All]: Checking server path for runtime ID: OSX_ARM64
[10:46:38] [PgToolsService Initialization] [All]: Tools Service path: /Users/<USERNAME>/.vscode/extensions/ms-ossdata.vscode-pgsql-1.26.0-darwin-arm64/pgsqltoolsservice/v3.4.1/OSX/pgsqltoolsservice/ossdbtoolsservice_main
[10:46:38] [PgToolsService Initialization] [All]: 
**************************************************
PG Tools Service log path can be found at:
/Users/<USERNAME>/Library/Application Support/Code/logs/20260714T103230/window2/exthost/ms-ossdata.vscode-pgsql/pgsql-tools.log
**************************************************

[10:46:38] [PgToolsService Initialization] [All]: Initializing language client
[10:46:38] [PgToolsService Initialization] [All]: Checking overrides for language client initialization
[10:46:38] [PgToolsService Initialization] [All]: Creating the language client with options: {"command":"/Users/<USERNAME>/.vscode/extensions/ms-ossdata.vscode-pgsql-1.26.0-darwin-arm64/pgsqltoolsservice/v3.4.1/OSX/pgsqltoolsservice/ossdbtoolsservice_main","args":["--log-file","/Users/<USERNAME>/Library/Application Support/Code/logs/20260714T103230/window2/exthost/ms-ossdata.vscode-pgsql/pgsql-tools.log","--parent-pid","<PID>","--mcp-mode","vscode-extension","--vscode-flavor","vscode","--application-name","Code","--data-path","/Users/<USERNAME>/Library/Application Support","--enable-sql-authentication-provider","--log-level","info","--instrumentation-key","<INSTRUMENTATION_KEY_1>","--mcp-instrumentation-key","<INSTRUMENTATION_KEY_2>","--vscode-machine-id","<MACHINE_ID>","--vscode-session-id","<SESSION_ID>","--vscode-extension-version","1.26.0","--vscode-version","1.128.0"],"transport":0}
[10:46:38] [PgToolsService Initialization] [All]: Language client created
[10:46:38] [PgToolsService Initialization] [All]: Starting language client
[10:46:38] [PgToolsService Initialization] [All]: Language client started
[10:46:38] [PgToolsService Initialization] [All]: Waiting for client to be ready
[10:46:39] [PgToolsService Initialization] [All]: Client is ready
[10:46:39] [McpNotificationHandler] Registered MCP notification handlers
[10:46:39] [MetricsService] [All]: MetricsService initialized
[10:46:39] [SessionsService] [All]: SessionsService initialized
[10:46:39] [serverDashboard] [Verbose]: Azure metadata service initialized for Server Dashboard
[10:46:39] [ToolsService] [Information]: ToolsService: registerTools called
[10:46:39] [ToolsService] [Information]: Registering LMT: pgsql_migration_oracle_app
[10:46:39] [ToolsService] [Information]: Registering LMT: pgsql_migration_show_report
[10:46:39] [ToolsService] [Information]: MCP available - filtered 14 tools with MCP equivalents
[10:46:39] [mainController] [All]: Azure Deployments view registered
[10:46:39] [mainController] [All]: Resuming deployment tracker with 0 staged profile(s)
[10:46:39] [mainController] [All]: Resume summary: no active deployments (pending: 0, deploying: 0, succeeded: 0, failed: 0)
[10:46:39] Initializing MCP service...
[10:46:39] MCP tool handlers registered
[10:46:39] [MigrationProjectService] [Information]: No postgres-migrations folder found in <PROJECT_A>: Error: ENOENT: no such file or directory, stat '/Users/<USERNAME>/develop/Projects/<PROJECT_A>/.github/postgres-migrations/'
[10:46:39] [MigrationProjectService] [Information]: No postgres-migrations folder found in <PROJECT_B>: Error: ENOENT: no such file or directory, stat '/Users/<USERNAME>/develop/<REPO_GROUP_1>/<PROJECT_B>/.github/postgres-migrations/'
[10:46:39] [MigrationProjectService] [Information]: No postgres-migrations folder found in <PROJECT_C>: Error: ENOENT: no such file or directory, stat '/Users/<USERNAME>/develop/<REPO_GROUP_2>/<PROJECT_C>/.github/postgres-migrations/'
[10:46:39] [MigrationProjectService] [Information]: No postgres-migrations folder found in <PROJECT_A>: Error: ENOENT: no such file or directory, stat '/Users/<USERNAME>/develop/Projects/<PROJECT_A>/.github/postgres-migrations/'
[10:46:39] [MigrationProjectService] [Information]: No postgres-migrations folder found in <PROJECT_B>: Error: ENOENT: no such file or directory, stat '/Users/<USERNAME>/develop/<REPO_GROUP_1>/<PROJECT_B>/.github/postgres-migrations/'
[10:46:39] [MigrationProjectService] [Information]: No postgres-migrations folder found in <PROJECT_C>: Error: ENOENT: no such file or directory, stat '/Users/<USERNAME>/develop/<REPO_GROUP_2>/<PROJECT_C>/.github/postgres-migrations/'
[10:46:40] MCP server not ready (attempt 1/30), retrying...
[10:46:41] MCP server registered with VS Code at http://127.0.0.1:<PORT>/mcp
[10:46:41] MCP service initialized successfully
[10:48:55] [PgToolsService Initialization] [Verbose]: readAllConnections: 1 connections; excluded recent)
[10:48:58] [connectionDialog] [All]: Initializing connection dialog
[10:48:58] [PgToolsService Initialization] [Verbose]: readAllConnections: 1 connections (1 from config, 0 from recent))
[10:48:59] [connectionDialog] [All]: Has connection to edit: false
[10:48:59] [PgToolsService Initialization] [Verbose]: Retreived 0 Azure accounts from account store.
[10:49:09] [ObjectExplorerService] [All]: Getting root OE nodes
[10:49:09] [PgToolsService Initialization] [Verbose]: readAllConnections: 1 connections; excluded recent)
[10:49:09] [PgToolsService Initialization] [Verbose]: readAllConnections: 1 connections; excluded recent)
[10:49:09] [ObjectExplorerService] [All]: Created OE root with 1
[10:49:13] [ObjectExplorerService] [All]: Getting children for node 'undefined'
[10:49:13] [ObjectExplorerService] [All]: [handleSessionCreated] Notification received: sessionId=objectexplorer://<CONNECTION_GUID>/, success=true, errorMessage=none, hasPromiseInMap=true, hasProfileInMap=true
[10:49:13] [ObjectExplorerService] [All]: [handleSessionCreated] Success path: nodeLabel=<DB_NAME> (PSQL), hasNodeConnection=true, reusingExistingNode=true
[10:49:13] [ObjectExplorerService] [All]: [handleSessionCreated] Connecting to objectexplorer://<CONNECTION_GUID>/...
[10:49:13] Connecting to server "<INTERNAL_DB_HOSTNAME>" on document "objectexplorer://<CONNECTION_GUID>/".
[10:49:13] Connected to server "<INTERNAL_DB_HOSTNAME>" on document "objectexplorer://<CONNECTION_GUID>/". Server information: {"isCloud":false,"server":"PostgreSQL","serverVersion":"11.22"}
[10:49:13] [ObjectExplorerService] [All]: [handleSessionCreated] Connection established for objectexplorer://<CONNECTION_GUID>/
[10:49:13] [ObjectExplorerService] [All]: Getting root OE nodes
[10:49:13] [PgToolsService Initialization] [Verbose]: readAllConnections: 1 connections; excluded recent)
[10:49:13] [ObjectExplorerService] [All]: Getting children for node 'objectexplorer://<CONNECTION_GUID>/'
[10:49:15] [connectionDialog] [All]: Connection to edit passed in with id: <CONNECTION_GUID> and profile name: <DB_NAME> (PSQL)
[10:49:15] [connectionDialog] [All]: Initializing connection dialog
[10:49:15] [PgToolsService Initialization] [Verbose]: readAllConnections: 2 connections (1 from config, 1 from recent))
[10:49:15] [connectionDialog] [All]: Has connection to edit: true
[10:49:15] [connectionDialog] [All]: Loading connection to edit
[10:49:15] [PgToolsService Initialization] [Verbose]: Retreived 0 Azure accounts from account store.
[10:49:42] [PgToolsService Initialization] [Verbose]: readAllConnections: 1 connections; excluded recent)
[10:49:42] Connected to server "<INTERNAL_DB_HOSTNAME>" on document "<CONNECTION_GUID>". Server information: {"isCloud":false,"server":"PostgreSQL","serverVersion":"11.22"}
[10:49:58] [PgToolsService Initialization] [Verbose]: readAllConnections: 1 connections; excluded recent)
[10:50:02] Connecting to server "<INTERNAL_DB_HOSTNAME>" on document "file:///Users/<USERNAME>/develop/Projects/<PROJECT_A>/Projects/<QUERY_FILE>.sql".
[10:50:17] Error connecting to server "<INTERNAL_DB_HOSTNAME>". Details: 
Connection error:
connection failed: connection to server at "<INTERNAL_IP>", port 5432 failed: fe_sendauth: no password supplied
[10:51:40] [PgToolsService Initialization] [Verbose]: readAllConnections: 1 connections; excluded recent)
[10:51:43] Connecting to server "<INTERNAL_DB_HOSTNAME>" on document "file:///Users/<USERNAME>/develop/Projects/<PROJECT_A>/Projects/<QUERY_FILE>.sql".
[10:51:58] Error connecting to server "<INTERNAL_DB_HOSTNAME>". Details: 
Connection error:
connection failed: connection to server at "<INTERNAL_IP>", port 5432 failed: fe_sendauth: no password supplied
[10:54:55] [PgToolsService Initialization] [Verbose]: readAllConnections: 1 connections; excluded recent)
[10:54:56] Connecting to server "<INTERNAL_DB_HOSTNAME>" on document "file:///Users/<USERNAME>/develop/Projects/<PROJECT_A>/Projects/<QUERY_FILE>.sql".
[10:55:11] Error connecting to server "<INTERNAL_DB_HOSTNAME>". Details: 
Connection error:
connection failed: connection to server at "<INTERNAL_IP>", port 5432 failed: fe_sendauth: no password supplied
[10:57:57] [PgToolsService Initialization] [Verbose]: readAllConnections: 1 connections; excluded recent)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions