Share via

Adding File to Vector Results in Indexing Failure - Internal Error Occurred

Alisha 0 Reputation points
2026-04-03T02:47:50.9633333+00:00

The agent is deployed by a container app that has the necessary access to the storage account, Azure AI Search and Foundry to create the vector store, add file to vector store and to add the file search tool to the agent. The action of adding a file (TXT file) to the vector store fails with 'Internal Error occurred'.

Code Snippets:

from azure.ai.agents.models import (FileInfo, FilePurpose, FileSearchTool,
                                    VectorStore, VectorStoreFile)
from azure.identity.aio import AzureCliCredential
from semantic_kernel.agents import AzureAIAgent, AzureAIAgentThread
logger.info(f"Uploading file to AI Agent service: {file_path}")
file: FileInfo = await client.agents.files.upload_and_poll(
      file_path=file_path,
      purpose=FilePurpose.AGENTS
)


vector_store: VectorStore = await client.agents.vector_stores.create_and_poll(
               name=vector_name
)


vector_store_file: VectorStoreFile = await client.agents.vector_store_files.create_and_poll(
                        vector_store_id=vector_store.id,
                        file_id=fid
)
Foundry Agent Service
Foundry Agent Service

A fully managed platform in Microsoft Foundry for hosting, scaling, and securing AI agents built with any supported framework or model


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.