mastra-ai/good-issue/issues
Claude Code and agent skill by mastra-ai/good-issue
- community
Checking that the SKILL.md file is still in the repository.
Install
npx vskill@latest install mastra-ai/good-issue/issuesSKILL.md
The same SKILL.md was published earlier as mastra-ai/good-issue/issues.
parse throws TypeError: Cannot read properties of undefined (reading 'toLowerCase') on empty values when coerce: true (v1.1.0)
Summary
When parse() is called with { coerce: true } and the config contains an empty value (KEY= or KEY=""), it crashes with TypeError: Cannot read properties of undefined (reading 'toLowerCase') instead of returning the empty string (or raising a proper ConfigError).
This is easy to hit in the wild: .env-style files commonly contain placeholder lines like API_KEY=. The same file parses fine with dotenv (which never coerces), which is why users perceive it as "my normal config crashes your library".
Reproduction
Single file, no dependencies beyond dotcfg:
Steps:
npm i dotcfg@1.1.0node repro.js
Output:
Falsifiability checks (both verified):
parse("FOO=")(nocoerce) →{ FOO: '' }✅parse("FOO=bar", { coerce: true })→{ FOO: 'bar' }✅parse('FOO=""', { coerce: true })also crashes (quoted empty value) ❌
Expected behavior
An empty value with coerce: true should return "" unchanged (there is nothing to coerce). The docs say allowEmpty defaults to true, so empty values are explicitly supported; if a user wants empties rejected, allowEmpty: false already throws a descriptive ConfigError. A raw TypeError from library internals should never escape.
Actual behavior
Environment
- dotcfg: 1.1.0
- Runtime: Node v22.22.2
- OS: macOS 15.6 (arm64)
- Options involved:
coerce: true(defaultallowEmpty: true)
Likely cause
src/index.ts, coerceValue(), line 103:
When v === "", v[0] is undefined, so .toLowerCase() throws. parse() calls coerceValue(value) unconditionally at line 77 whenever coerce is set, and empty values are allowed by default (allowEmpty: true), so any KEY= line triggers it.
Suggested fix (one line):
(or const first = v[0]?.toLowerCase();). Happy to send a PR with the fix plus a regression test for parse("FOO=", { coerce: true }) and parse('FOO=""', { coerce: true }).
Related issues
No duplicate found — searched the tracker (open and closed) for toLowerCase, coerce, empty value, and TypeError. Not mentioned in the changelog; reproduced on the latest release (1.1.0).
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckinggym/results/issues/c01-skill.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/mastra-ai/good-issue/issues)