Skip to content

[VSCE] Check if .env is a file, not a folder, before trying to read it #397

@drewbanin

Description

@drewbanin

Ran into this here: https://dbt-labs.slack.com/archives/C0895CBHERZ/p1749247382945849

Fails with an error like:

2025-06-06 17:08:27.167 [error] Error: EISDIR: illegal operation on a directory, read
	at Object.readSync (node:fs:751:18)
	at tryReadSync (node:fs:425:20)
	at Object.readFileSync (node:fs:479:19)
	at t.readFileSync (node:electron/js2c/node_init:2:10175)
	at wh (/Users/brandon/.cursor/extensions/dbtlabsinc.dbt-0.2.6/dist/extension.js:215:6609)
	at t.createTask (/Users/brandon/.cursor/extensions/dbtlabsinc.dbt-0.2.6/dist/extension.js:216:719)
	at t.createAndRun (/Users/brandon/.cursor/extensions/dbtlabsinc.dbt-0.2.6/dist/extension.js:216:330)
	at Dh.runWorkspaceCommand (/Users/brandon/.cursor/extensions/dbtlabsinc.dbt-0.2.6/dist/extension.js:219:611)
	at /Users/brandon/.cursor/extensions/dbtlabsinc.dbt-0.2.6/dist/extension.js:314:3595
	at async Wet.h (file:///Applications/Cursor.app/Contents/Resources/app/out/vs/workbench/api/node/extensionHostProcess.js:135:33097) dbt.openBuildMenu {"value":"dbtLabsInc.dbt","_lower":"dbtlabsinc.dbt"}

It's a tough one to debug because 1) the path is not shown in the error and 2) it impacts both LSP startup + dbt invocations (both code paths try to read env vars)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingvscePertains to the VS Code Extension / Language Server

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions