Error inserting: null value in column "" of relation "" violates not-null constraint

Hi i’m learnin n8n and this is my first workflow. I was trying to implement agentic rag system from https://medium.com/@ahsenelmas1/build-an-agentic-rag-chatbot-with-n8n-google-drive-supabase-and-pgvector-step-by-step-e05b1c5d5a18

But I stuck on ingecting of vector db step. I’ve got an error “Error inserting: null value in column “doc_id” of relation “documents” violates not-null constraint“ on pg vector store node.

My workflow

Information on your n8n setup

  • n8n version: 1.111.1
  • Database (default: SQLite): postgres
  • Running n8n via Docker
  • Operating system: Ubuntu

I would need to check your specific setup. However, from just looking at the nodes it is clear where the error comes from right? Right in the “Set File ID” node one of your items has an item with the doc_id of null soyou can just check the first bit of the flow to find out the issue. In “Create Document Rows Table” you have defined “doc_id TEXT NOT NULL REFERENCES document_metadata(id) ON DELETE CASCADE,” so that is why it doesnt allow null.

Additionally, I can recommend to checkout some of the flows from Cole Medin. For example you can import this RAG workflow which has almost the same structure as yours:

You can probably modify it easily to fit your use case :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.