contract emit crashes (CLI.UNEXPECTED, ERR_INVALID_ARG_VALUE) with the relative contract path that orm init scaffolds
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- node.js, typescript
Research direction
Start at cli-engine's loadConfig and trace how the relative contract path becomes projectRoot before validateContractDeps calls createRequire. Reproduce the default orm init scaffold and contract emit flow, then verify that the relative path works without ERR_INVALID_ARG_VALUE and that contract.json and contract.d.ts are emitted successfully.
Written by the indexing model from the issue text.
Description
Summary
orm init scaffolds prisma.config.ts with a relative contract path:
orm: ormConfig({
contract: "./src/prisma/contract.prisma",
db: { connection: process.env['DATABASE_URL']! },
}),
With that config, contract emit crashes:
CLI.UNEXPECTED: The argument 'filename' must be a file URL object, file URL string, or absolute path
string. Received './src/prisma/package.json' (ERR_INVALID_ARG_VALUE)
Changing the config to an absolute path (new URL('./src/prisma/contract.prisma', import.meta.url).pathname) makes the same command succeed and emit contract.json/contract.d.ts normally.
Where it breaks
In @prisma/[email protected] (dist ref-*.mjs), validateContractDeps does:
const resolve = createRequire(`${projectRoot}/package.json`);
and projectRoot arrives as the relative ./src/prisma derived from the config's contract path, but node:module's createRequire requires an absolute path or file URL. Either the config loader should absolutize contract against the config file's directory before handing it to the toolchain, or the toolchain should resolve projectRoot to an absolute path itself.
Filing here because the repro is entirely through prisma-cli commands and the config loader (cli-engine loadConfig) may be the layer that should absolutize; transfer to the ORM repo if it's purely an orm-toolchain fix.
Repro caveat
Reproduced on macOS / Node 24.11.1 with the rc.4 CLI shell and a locally patched @prisma/cli-engine built from repo HEAD, because the published engine crashes the CLI at startup (#202). I could not verify against a fully published stack for that reason. Today users hit this bug's surface anyway: orm init's final emit step fails with CLI.INIT_EMIT_FAILED due to #202, and once that is fixed, this crash is the next thing the default scaffold + contract emit flow runs into (unless the published engine absolutizes the path where the HEAD engine does not).
Found while validating the docs quickstart end to end (prisma/web#8151).
🤖 Filed with Claude Code on behalf of [email protected]
- Dominant language
- TypeScript
- Stars
- 21
- Forks
- 2
- Avg merge
- 16h 42m
- Merged PRs (30d)
- 40
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing 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 prisma/prisma-cli
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
prisma/prisma-cli#309 · 1 comment ·
Maintainers usually reply within 1 day
-
The update notice tells users to install @prisma/cli and does not recognise a global prisma installOpen
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
prisma/prisma-cli#306 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
prisma/prisma-cli#305 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
prisma/prisma-cli#302 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
prisma/prisma-cli#300 ·
Maintainers usually reply within 1 day
All issues in prisma/prisma-cli
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
siyuan-note/siyuan#20040 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
RunestoneInteractive/rs#1574 ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
remotion-dev/remotion#11901 ·
Maintainers usually reply within 1 day
-
Poll constructor throws for an uncached channel while resolving a message context-menu interactionOpenbug need repro packages:discord.js
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
discordjs/discord.js#11645 ·
Maintainers usually reply within 3 days
-
🐞 bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Sitecore/content-sdk#641 ·
Maintainers usually reply within 2 days