Failed to load config (Cannot use 'in' operator to search for 'kind' in typeChoice)

Open
#2,012 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
next.js, node.js, typescript, vscode

Research direction

The failing load is in the language server's config loading for prisma.config.ts, so start where the error message 'Failed to load ... Cannot use in operator' is produced and trace how the exported config value is checked for a 'kind' field, such as the typeChoice handling. Reproduce by opening a project whose config uses definePrismaConfig with an orm config, then fix the check so it handles that value. Done when the config loads without the error and the Output panel stays clean.

Written by the indexing model from the issue text.

Description

Bug description

The extension fails to load the config file. It returns the following error:

Prisma could not load "prisma.config.ts". Formatting and other language features are unavailable until the configuration loads.

The Output displays this:

Failed to load c:\users\user\projects\my-project\prisma.config.ts: Cannot use 'in' operator to search for 'kind' in typeChoice

prisma.config.ts

import 'dotenv/config';
import { definePrismaConfig } from '@prisma/cli-engine';
import { defineConfig as ormConfig } from '@prisma/orm-postgres/config';

export default definePrismaConfig({
  orm: ormConfig({
    contract: "./src/prisma/contract.prisma",
    db: {
      connection: process.env['DATABASE_URL']!,
    },
  }),
});

My package.json

{
  "name": "my-project",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "eslint",
    "contract:emit": "prisma contract emit"
  },
  "dependencies": {
    "@prisma/orm-postgres": "^8.0.0-rc.22",
    "next": "16.4.3",
    "react": "19.3.0",
    "react-dom": "19.3.0"
  },
  "devDependencies": {
    "@prisma/cli-engine": "^0.9.0",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "dotenv": "^18.0.9",
    "eslint": "^10.13.0",
    "eslint-config-next": "16.4.3",
    "prisma": "^8.0.0-rc.29",
    "typescript": "^5"
  },
  "allowScripts": {
    "[email protected]": true
  }
}

I also tried using the insider version (31.12.17) of the extension.

Environment & setup

  • OS: Windows
  • Editor: VS Code
  • Editor version: 1.144.0
  • Extension version: 31.13.0
Dominant language
TypeScript
Stars
298
Forks
53
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from prisma/language-tools

All issues in prisma/language-tools

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.