{"record":{"id":"9de01e12e94626f4","repo":"spring-projects/spring-ai","slug":"documents-are-ingested-via-data-source-sync-not-d","errorCode":null,"errorMessage":"Documents are ingested via data source sync, not direct add.","messagePattern":"Documents are ingested via data source sync, not direct add\\.","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"warning","filePath":"vector-stores/spring-ai-bedrock-knowledgebase-store/src/main/java/org/springframework/ai/vectorstore/bedrockknowledgebase/BedrockKnowledgeBaseVectorStore.java","lineNumber":103,"sourceCode":"\t\tthis.searchType = builder.searchType;\n\t\tthis.rerankingModelArn = builder.rerankingModelArn;\n\t\tthis.filterConverter = builder.filterConverter != null ? builder.filterConverter\n\t\t\t\t: new BedrockKnowledgeBaseFilterExpressionConverter();\n\t}\n\n\t/**\n\t * Creates a new builder for BedrockKnowledgeBaseVectorStore.\n\t * @param client the Bedrock Agent Runtime client\n\t * @param knowledgeBaseId the ID of the Knowledge Base to query\n\t * @return a new builder instance\n\t */\n\tpublic static Builder builder(final BedrockAgentRuntimeClient client, final String knowledgeBaseId) {\n\t\treturn new Builder(client, knowledgeBaseId);\n\t}\n\n\t@Override\n\tpublic void add(final List<Document> documents) {\n\t\tthrow new UnsupportedOperationException(\"Documents are ingested via data source sync, not direct add.\");\n\t}\n\n\t@Override\n\tpublic void delete(final List<String> idList) {\n\t\tthrow new UnsupportedOperationException(\"Documents are managed via data source, not direct delete.\");\n\t}\n\n\t@Override\n\tpublic void delete(final Filter.Expression filterExpression) {\n\t\tthrow new UnsupportedOperationException(\"Documents are managed via data source, not direct delete.\");\n\t}\n\n\t@Override\n\tpublic List<Document> similaritySearch(final SearchRequest request) {\n\t\tAssert.notNull(request, \"SearchRequest must not be null\");\n\t\tAssert.hasText(request.getQuery(), \"Query must not be empty\");\n\n\t\tint topK = request.getTopK() > 0 ? request.getTopK() : this.defaultTopK;","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/spring-projects/spring-ai/blob/98a7beda4f29d80a71c5837eb4053b03a93a46f7/vector-stores/spring-ai-bedrock-knowledgebase-store/src/main/java/org/springframework/ai/vectorstore/bedrockknowledgebase/BedrockKnowledgeBaseVectorStore.java#L85-L121","documentation":"BedrockKnowledgeBaseVectorStore.add(List<Document>) is deliberately unsupported because documents enter a Bedrock Knowledge Base through a configured data source and ingestion/sync jobs, not by direct vector writes. Calling add always throws an UnsupportedOperationException telling the developer to use data-source ingestion instead.","triggerScenarios":"Calling store.add(documents) directly, using a generic ingestion pipeline that calls VectorStore.add for any store implementation, or swapping a different VectorStore (e.g. PgVector) for BedrockKnowledgeBaseVectorStore in existing embedding-write code.","commonSituations":"Reusing ETL/embedding code written for other vector stores; attempting to add freshly embedded documents without an S3 data source; demo/prototype code that assumes all VectorStore implementations support writes.","solutions":["Upload documents to the configured data source (typically S3) and trigger a knowledge base ingestion job via BedrockAgentClient.startIngestionJob instead of calling add","Catch UnsupportedOperationException around add in generic write paths and route to the data-source ingestion flow for this store type","Configure the knowledge base's data source properly (S3 bucket/prefix) so ingestion picks up new documents","Guard shared code by checking store type before calling add"],"exampleFix":"// before\nvectorStore.add(List.of(new Document(\"text\"))); // UnsupportedOperationException\n// after\ns3Client.putObject(b -> b.bucket(bucket).key(\"doc1.txt\"), RequestBody.fromString(\"text\"));\nbedrockAgentClient.startIngestionJob(b -> b.knowledgeBaseId(kbId).dataSourceId(dsId));","handlingStrategy":"try-catch","validationCode":"if (store instanceof BedrockKnowledgeBaseVectorStore) { throw new IllegalStateException(\"Use data source ingestion for Bedrock KB; add() is unsupported\"); }","typeGuard":"boolean supportsAdd(VectorStore store) { return !(store instanceof BedrockKnowledgeBaseVectorStore); }","tryCatchPattern":"try { store.add(documents); } catch (UnsupportedOperationException e) { uploadToS3AndStartIngestion(documents); }","preventionTips":["Ingest into Bedrock KB via the configured data source plus startIngestionJob","Branch ingestion pipelines on store type instead of assuming VectorStore.add works","Document the write path for KB-backed stores in team runbooks","Catch UnsupportedOperationException in generic VectorStore writers"],"tags":["bedrock","ingestion","unsupported-operation","aws"],"backgroundTag":"operation-not-supported","analyzedSha":"98a7beda4f29d80a71c5837eb4053b03a93a46f7","analyzedAt":"2026-09-11T14:15:49.441Z","contentChangedAt":"2026-09-11T14:15:49.441Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}