[BUG]: drizzle-kit swallows stack traces on schema-load errors, printing only the message
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- nodejs, typescript
- Domain
- cli
Research direction
Start in src/cli/index.ts at the unknown_error theme handler described in the issue, then reproduce the failure with the provided schema and drizzle.config.ts using drizzle-kit generate. Confirm the completed behavior by checking that schema-loading errors include their stack traces for generate, migrate, push, and other schema-loading commands.
Written by the indexing model from the issue text.
Description
What version of drizzle-orm are you using?
1.0.0-rc.3
What version of drizzle-kit are you using?
1.0.0-rc.3
Other packages
No response
Describe the Bug
When a schema file throws during module evaluation, drizzle-kit generate prints only the error message and exits. The stack trace is discarded, so there is no indication of which file or line crashed.
Repro: point the config at a schema file that throws while loading.
// schema.ts
import { pgTable, text } from "drizzle-orm/pg-core";
const broken: { kind: string } | undefined = undefined;
console.log(broken!.kind); // stand-in for any eval-time crash
export const users = pgTable("users", { id: text("id") });
// drizzle.config.ts
import { defineConfig } from "drizzle-kit";
export default defineConfig({
dialect: "postgresql",
schema: "./schema.ts",
out: "./migrations",
});
$ drizzle-kit generate
Reading config file 'drizzle.config.ts'
Error Cannot read properties of undefined (reading 'kind')
That single line is the entire output. In a real project the schema spans dozens of files, and an eval-time crash (ours came from a circular import that left a table half-initialized) gives you nothing to go on. We ended up patching bin.cjs to recover the stack:
Error Cannot read properties of undefined (reading 'kind')
TypeError: Cannot read properties of undefined (reading 'kind')
at /path/to/server/schema.ts:5:20
at async Function.import (node_modules/drizzle-kit/bin.cjs:38495:17)
at async prepareFromSchemaFiles$5 (node_modules/drizzle-kit/bin.cjs:89621:35)
...
The swallow happens in the CLI's unknown_error theme handler (src/cli/index.ts), which logs e.message and returns. Printing e.stack there (or behind a --verbose flag) would make schema-loading crashes debuggable.
The same applies to migrate, push, and any other command that loads schema files.
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from drizzle-team/drizzle-orm
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
drizzle-team/drizzle-orm#6287 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
drizzle-team/drizzle-orm#6229 ·
-
bug drizzle/kit
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
drizzle-team/drizzle-orm#6214 ·
-
bug bug/fixed-in-beta drizzle/kit
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
drizzle-team/drizzle-orm#6192 · 3 comments ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
drizzle-team/drizzle-orm#6162 · 3 comments · 1 reaction ·
All issues in drizzle-team/drizzle-orm
Similar issues
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Automattic/studio#4908 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100