← Back to Pull requests

fix: resolve the Prisma ORM 8 CLI from the nearest node_modules #2010

Closed
unknown closed this pull request without merging on Oct 08, 2026 13:53 UTC
View on GitHub
unknown unknown commented on Oct 08, 2026 13:40 UTC
Author

In a monorepo, Prisma ORM 8 language features did not work when prisma was installed in a package (for example apps/api) and the monorepo root was opened in VS Code.

Problem

The extension looked for the CLI only at <workspace folder>/node_modules/prisma/dist/prisma.js.

  • With prisma installed only in apps/api, no Prisma ORM 8 language server started, and VS Code reported "There is no formatter for 'prisma' files installed."

  • After accepting the install prompt, prisma@latest was installed at the workspace root and used for prisma lsp. When that version differed from the @prisma/orm-* packages in apps/api, loading apps/api/prisma.config.ts failed with PRISMA_CONFIG_LOAD_FAILED. The server still advertised formatting but returned no edits.
  • Reproduced by driving prisma lsp over stdio in a pnpm monorepo with the schema at apps/api/src/prisma/contract.prisma:

    | CLI used for prisma lsp | @prisma/orm-postgres in apps/api | Formatting result |
    |---|---|---|
    | root, 8.0.0-rc.21 | 8.0.0-rc.12 | no edits, PRISMA_CONFIG_LOAD_FAILED |
    | apps/api, 8.0.0-rc.17, cwd apps/api | 8.0.0-rc.12 | formats correctly |

    Changes

  • Search for node_modules/prisma from the schema file's directory up to the workspace folder. The search does not go above the workspace folder.

  • Start prisma lsp with the directory that contains the selected node_modules as its working directory, and scope the client's document selector to that directory.

  • Start one language server per directory with an installed CLI instead of one per workspace folder, so packages with different CLI versions each use their own.

  • Update the document routing section of docs/language-server.md.

  • Show an error notification when the Prisma ORM 8 server publishes a PRISMA_CONFIG_LOAD_FAILED diagnostic. The diagnostic is attached to prisma.config.ts, so it was easy to miss while editing a schema. The notification names the config file and has two actions: "Open config", and "Show details", which reveals the language server's output channel where the server's error message is written. It is shown once per config file and failure message, and again if the failure clears and returns.
  • Not covered

  • When a CLI at the workspace root and a CLI in a nested package are both in use at the same time, the root server's document selector also matches the nested package's files, so those files can receive duplicate diagnostics and completions.

  • The install prompt is unchanged: when no CLI is found, it still installs prisma@latest at the workspace root.

  • If a package is opened as the workspace folder and prisma is hoisted above it, the CLI is still not found.
  • Validation

  • vitest run tests/__tests__ in packages/vscode: 55 tests pass, including six new monorepo resolution cases and twelve for the config load failure notification.

  • tsc --noEmit and eslint pass for packages/vscode.

  • Not run in a VS Code window; the integration suite was not executed.
  • 🤖 Generated with Claude Code

    Diff: 385 lines (+288 / -97) across 4 files Reviewer: SevInf Review duration: 12m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 385 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.356
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #2010"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 43% (MEDIUM) · Higher = larger blast radius
    43%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 17.0% · Safe to merge
    17.0%