Announcements
This site is in read only until July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Problems With Rag Engine

1) I uploaded a .jsonl file containing 600 objects to Google Cloud Storage, but when I attempt to import it into Vertex AI RAG Corpus, it throws a cryptic 'KC' error. The error message is unclear and doesn't provide actionable details.

2) I uploaded another .jsonl file to Google Drive and shared it with the Vertex AI RAG engine service account, but when I try to import the file from the shared folder into the RAG Corpus, the folder appears empty. The file isn’t detected. 

3) When I use the "Create Prompt" tab in the Vertex AI UI to query my vectorized data, it returns results along with chain-of-thought reasoning and citations. Will I get the same chain-of-thought style output (reasoning + citations) when querying the RAG system through the Vertex AI SDK or API?

0 2 343
2 REPLIES 2

Hi @saintaze,

Welcome to Google Cloud Community!

Here are my responses to your questions:

1. Google Cloud Storage Import – “KC” Error: The “KC” error may relate to formatting or schema validation issues during ingestion. Here are a few things to check:

  • File format: Ensure your .jsonl file is UTF-8 encoded and each line is a valid JSON object.
  • Required fields: Vertex AI RAG expects specific fields like title, content, or text. If your objects are missing these or are nested in unexpected ways, ingestion may silently fail.
  • File size or object count: While 600 objects is reasonable, malformed entries or overly large payloads per line can cause ingestion hiccups.

If the error persists, try importing a smaller subset (e.g., 5–10 lines) to isolate the issue. Also, consider using the Import RAG Files API with import_result_sink enabled to capture detailed error logs.

2. Google Drive Import – Shared Folder Appears Empty: This is a common mistake. Even if you’ve shared the file with the service account, Vertex AI RAG can only import from folders where the service account has Viewer access and the file is in the My Drive or Shared Drive, not just “Shared with me. Here’s what you can do:

  • Move the file into a folder you own in your Google Drive.
  • Share the entire folder with the Vertex AI RAG service account.
  • Grant Viewer permission (not just Commenter or Editor).
  • Use the folder’s resource ID, not the file’s, when importing.

Note that, If the folder still appears empty, double-check that the file type and size are supported and that the file isn’t restricted by organization-level sharing policies.

3. Chain-of-Thought Reasoning via SDK/API: Yes, you can get chain-of-thought reasoning and citations when querying via the Vertex AI SDK or API—if you’re using the same Gemini models and prompt orchestration as the UI. Here’s what you can check:

  • The Gemini models (like gemini-1.5-pro) support reasoning tokens and citations.
  • The SDK exposes this via the reasoning_engines module or through the streamText() function, which emits “thinking” tokens representing the model’s internal reasoning.
  • To replicate the UI behavior, you’ll want to use the Agent Engine API or LangChain integration with the same prompt templates used in the UI.

If the issue persists, you may reach out to Google Cloud Support. When reaching out, include detailed information and relevant screenshots of the errors you’ve encountered. This will assist them in diagnosing and resolving your issue more efficiently.

Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.

I do have the 'Viewer permission' set on the folder in Google Drive and still nothing is shown. The file format and size is the same as in Storage Bucket and I can load it from there. No permission issues from the organisation as well. 

Also, is it possible to set custom metadata to each chunk when chunks are created, like {parentId: '' ....} and other fields, so I  can trace back to the original article from which chunks were created?