Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

contract emit crashes (CLI.UNEXPECTED, ERR_INVALID_ARG_VALUE) with the relative contract path that orm init scaffolds

クローズ
#205 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
52/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
node.js, typescript
領域
cli, tooling

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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]

主要言語
TypeScript
スター
23
フォーク
2
平均マージ
22時間 20分
マージ済み PR(30日)
44

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

prisma/prisma-cli のほかの issue

prisma/prisma-cli の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。