Repository navigation
Description
Hi,
We have some .env oddities in our codebase which are causing an issue where this CLI crashes on startup. I'm going to patch the CLI for myself using the prompt below, which I also wrote. If there's an alternative framing you'd propose to lead to a better solution, let me know and I'll go that way plus share the results in a PR. If taking a change like this upstream is undesirable, I totally understand that, too.
Anyway, here's my prompt for what it's worth, and please let me know if you're interested in collaborating more on an improvement here.
The Linear CLI crashes in our monorepo with this issue:
error: Uncaught (in promise) IsADirectory: Is a directory (os error 21): readfile '.env' return parse(await Deno.readTextFile(filepath)); ^ at async Object.readTextFile (ext:deno_fs/30_fs.js:814:18) at async parseFile (https://jsr.io/@std/dotenv/0.225.6/mod.ts:244:18) at async load (https://jsr.io/@std/dotenv/0.225.6/mod.ts:217:26) at async loadEnvFiles (file:///var/folders/2b/8_tpkwdj7d574_pqq2j_dz2h0000gq/T/deno-compile-linear/src/config.ts:80:15) at async file:///var/folders/2b/8_tpkwdj7d574_pqq2j_dz2h0000gq/T/deno-compile-linear/src/config.ts:113:1 error: Uncaught (in promise) IsADirectory: Is a directory (os error 21): readfile '.env' return parse(await Deno.readTextFile(filepath)); ^ at async Object.readTextFile (ext:deno_fs/30_fs.js:814:18) at async parseFile (https://jsr.io/@std/dotenv/0.225.6/mod.ts:244:18) at async load (https://jsr.io/@std/dotenv/0.225.6/mod.ts:217:26) at async loadEnvFiles (file:///var/folders/2b/8_tpkwdj7d574_pqq2j_dz2h0000gq/T/deno-compile-linear/src/config.ts:80:15) at async file:///var/folders/2b/8_tpkwdj7d574_pqq2j_dz2h0000gq/T/deno-compile-linear/src/config.ts:113:1 error: Uncaught (in promise) IsADirectory: Is a directory (os error 21): readfile '.env' return parse(await Deno.readTextFile(filepath)); ^ at async Object.readTextFile (ext:deno_fs/30_fs.js:814:18) at async parseFile (https://jsr.io/@std/dotenv/0.225.6/mod.ts:244:18) at async load (https://jsr.io/@std/dotenv/0.225.6/mod.ts:217:26) at async loadEnvFiles (file:///var/folders/2b/8_tpkwdj7d574_pqq2j_dz2h0000gq/T/deno-compile-linear/src/config.ts:80:15) at async file:///var/folders/2b/8_tpkwdj7d574_pqq2j_dz2h0000gq/T/deno-compile-linear/src/config.ts:113:1It's because we have a weird structure with a
.envdirectory. We also don't
follow popular.envfile conventions; they may contain some zsh syntax in them
because SWEs typically source the files in their shell instead of treating them
as a true.env.The Linear CLI shouldn't crash on startup if an invalid
.envis encountered.
Handle this reasonably but more gracefully. Note that, ultimately, the issue is
our own unusual behavior in our codebase. Being entirely silent about the issue
may hide deeper issues and also would cause the Linear CLI to diverge from
industry standards. We can't mindlessly do that and instead need to strike a
compromise.
Activity
jackarch-2 commentedon Aug 26, 2026
The issue is more specifically here:
linear-cli/src/config.ts
Line 84 in 5af8286
.envis a directory, we move on and try to load it.I think the simplest solution is fine: silently do nothing for
.envdirectories.Follow-up to #265: report unusable .env files and stop the dotenv hang
Follow-up to #265: report unusable .env files and stop the dotenv hang
schpetbot commentedon Sep 2, 2026
Shipped in v2.6.0.
Thanks for the report — the crash and the hang are both fixed.
.envthat is a directory no longer crashes the CLI on startup..envwritten to besourced by a shell no longer hangs forever; a self-referential value likeexport PATH=$PATH:/opt/binused to spin the dotenv expander indefinitely..envis now reported as a warning on stderr and skipped, and the repository-root.envis still consulted as a fallback.$VARin aLINEAR_/GH_/GITHUB_value is skipped with a warning instead of expanded — expanding an unset variable silently produced the string"undefined".LINEAR_IGNORE_ENV_FILE=1skips.envloading entirely, for repositories whose.envis not dotenv-shaped.Fixed by your #265 plus the follow-up in #269.