Skip to content

@langchain/community prisma vector store invalid table & columns if using map #9802

@juniardys

Description

@juniardys

Checked other resources

  • This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
  • I added a very descriptive title to this issue.
  • I searched the LangChain.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

Example Code

Here is my schema.prisma

model Document {
  id              String                 @id @default(cuid())
  documentContent String                 @map("document_content")
  documentVector  Unsupported("vector")? @map("document_vector")

  @@map("documents")
}

And here is the example code:

const vectorStore = PrismaVectorStore.withModel<Document>(prisma).create(
    embeddings,
    {
      prisma: Prisma,
      tableName: "Document",
      vectorColumnName: "documentVector",
      columns: {
        id: PrismaVectorStore.IdColumn,
        documentContent: PrismaVectorStore.ContentColumn,
      },
    }
  );

Error Message and Stack Trace (if applicable)

PrismaClientKnownRequestError:
Invalid prisma.$executeRaw() invocation:

Raw query failed. Code: 42P01. Message: relation "Document" does not exist
at qr.handleRequestError (D:\Workshop\experiments\langchain-prisma-experiments\node_modules.pnpm@prisma+client@7.2.0_prisma_cc6a828049883b98ef5d9d9c4971082c\node_modules@prisma\client\src\runtime\RequestHandler.ts:228:13)
at qr.handleAndLogRequestError (D:\Workshop\experiments\langchain-prisma-experiments\node_modules.pnpm@prisma+client@7.2.0_prisma_cc6a828049883b98ef5d9d9c4971082c\node_modules@prisma\client\src\runtime\RequestHandler.ts:174:12)
at qr.request (D:\Workshop\experiments\langchain-prisma-experiments\node_modules.pnpm@prisma+client@7.2.0_prisma_cc6a828049883b98ef5d9d9c4971082c\node_modules@prisma\client\src\runtime\RequestHandler.ts:143:12)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async a (D:\Workshop\experiments\langchain-prisma-experiments\node_modules.pnpm@prisma+client@7.2.0_prisma_cc6a828049883b98ef5d9d9c4971082c\node_modules@prisma\client\src\runtime\getPrismaClient.ts:805:24) {
code: 'P2010',
meta: {
driverAdapterError: DriverAdapterError: TableDoesNotExist
at PgTransaction.onError (file:///D:/Workshop/experiments/langchain-prisma-experiments/node_modules/.pnpm/@prisma+adapter-pg@7.2.0/node_modules/@prisma/adapter-pg/dist/index.mjs:651:11)
at PgTransaction.performIO (file:///D:/Workshop/experiments/langchain-prisma-experiments/node_modules/.pnpm/@prisma+adapter-pg@7.2.0/node_modules/@prisma/adapter-pg/dist/index.mjs:646:12)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async PgTransaction.executeRaw (file:///D:/Workshop/experiments/langchain-prisma-experiments/node_modules/.pnpm/@prisma+adapter-pg@7.2.0/node_modules/@prisma/adapter-pg/dist/index.mjs:605:13)
at async (D:\Workshop\experiments\langchain-prisma-experiments\node_modules.pnpm@prisma+client@7.2.0_prisma_cc6a828049883b98ef5d9d9c4971082c\node_modules@prisma\client-engine-runtime\src\tracing.ts:68:22)
at async fr (D:\Workshop\experiments\langchain-prisma-experiments\node_modules.pnpm@prisma+client@7.2.0_prisma_cc6a828049883b98ef5d9d9c4971082c\node_modules@prisma\client-engine-runtime\src\tracing.ts:56:10)
at async e.interpretNode (D:\Workshop\experiments\langchain-prisma-experiments\node_modules.pnpm@prisma+client@7.2.0_prisma_cc6a828049883b98ef5d9d9c4971082c\node_modules@prisma\client-engine-runtime\src\interpreter\query-interpreter.ts:172:18)
at async e.run (D:\Workshop\experiments\langchain-prisma-experiments\node_modules.pnpm@prisma+client@7.2.0_prisma_cc6a828049883b98ef5d9d9c4971082c\node_modules@prisma\client-engine-runtime\src\interpreter\query-interpreter.ts:96:23)
at async e.execute (D:\Workshop\experiments\langchain-prisma-experiments\node_modules.pnpm@prisma+client@7.2.0_prisma_cc6a828049883b98ef5d9d9c4971082c\node_modules@prisma\client\src\runtime\core\engines\client\LocalExecutor.ts:81:12)
at async Dt.requestBatch (D:\Workshop\experiments\langchain-prisma-experiments\node_modules.pnpm@prisma+client@7.2.0_prisma_cc6a828049883b98ef5d9d9c4971082c\node_modules@prisma\client\src\runtime\core\engines\client\ClientEngine.ts:548:28) {
cause: [Object]
}
},
clientVersion: '7.2.0'
}

Description

  • I'm trying to use langchain with prisma vector store
  • Issue happened when my prisma schema using map
  • It make showing that the table does not exists

System Info

langchain@1.2.8 | MIT | deps: 5 | versions: 371
Typescript bindings for langchain
https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain/

keywords: llm, ai, gpt3, chain, prompt, prompt engineering, chatgpt, machine learning, ml, openai, embeddings, vectorstores

dist
.tarball: https://registry.npmjs.org/langchain/-/langchain-1.2.8.tgz
.shasum: b1ebfcbcdcced6742eb02a766343d29a1b1c6a21
.integrity: sha512-d2WYSVBUK7d3rX1pfYoDBLANWpqgKlTPbc1zjQmJj1zsLPV5rUlF0jZXdy+fdxiqtG7vSaVuaX8H3cp26pWR5w==
.unpackedSize: 3.2 MB

dependencies:
@langchain/langgraph-checkpoint: ^1.0.0 langsmith: >=0.4.0 <1.0.0 zod: ^3.25.76 || ^4
@langchain/langgraph: ^1.0.0 uuid: ^10.0.0

maintainers:

dist-tags:
alpha: 1.0.0-alpha.9 latest: 1.2.8 tag-for-publishing-older-releases: 0.2.20
dev: 1.2.7-dev-1767822302252 next: 1.0.0-alpha.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions