{"record":{"id":"256e32e47c120b6e","repo":"iflytek/astron-agent","slug":"sparkdesk-rag-does-not-support-chunks-delete-operation","errorCode":null,"errorMessage":"SparkDesk-RAG does not support chunks_delete operation.","messagePattern":"SparkDesk-RAG does not support chunks_delete operation\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"core/knowledge/service/impl/sparkdesk_strategy.py","lineNumber":141,"sourceCode":"\n    async def chunks_delete(\n        self, docId: str, chunkIds: List[str], **kwargs: Any\n    ) -> Any:\n        \"\"\"\n        Delete chunks\n\n        Args:\n            doc_id: Document ID\n            chunk_ids: Chunk ID list\n            **kwargs: Other parameters\n\n        Returns:\n            Delete result\n\n        Raises:\n            NotImplementedError: SparkDesk-RAG does not support delete operation\n        \"\"\"\n        raise NotImplementedError(\n            \"SparkDesk-RAG does not support chunks_delete operation.\"\n        )\n\n    async def query_doc(self, docId: str, **kwargs: Any) -> List[dict]:\n        \"\"\"\n        Query all chunks of a document\n\n        Args:\n            doc_id: Document ID\n            **kwargs: Other parameters\n\n        Returns:\n            List of chunk information\n\n        Raises:\n            NotImplementedError: SparkDesk-RAG does not support document query operation\n        \"\"\"\n        raise NotImplementedError(\"SparkDesk-RAG does not support query_doc operation.\")","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/service/impl/sparkdesk_strategy.py#L123-L159","documentation":"SparkDeskRagStrategy.chunks_delete() is an intentional stub raising NotImplementedError. SparkDesk-RAG has no API to delete individual chunks, so the adapter rejects the operation while still satisfying the RagStrategy abstract interface.","triggerScenarios":"Calling chunks_delete(docId, chunkIds) on a SparkDesk-RAG strategy, e.g. removing selected chunks from a knowledge-base document.","commonSituations":"Chunk-management features implemented for other RAG backends reused against SparkDesk-RAG; cleanup jobs deleting stale chunks.","solutions":["Delete the whole document and re-upload without the unwanted content","Disable or hide chunk deletion for SparkDesk-RAG backends in the caller","Implement chunks_delete if SparkDesk later exposes a chunk-level delete API"],"exampleFix":"// before\nawait strategy.chunks_delete(docId, chunkIds)\n// after\nif isinstance(strategy, SparkDeskRagStrategy):\n    await strategy.delete_document(docId)\nelse:\n    await strategy.chunks_delete(docId, chunkIds)","handlingStrategy":"validation","validationCode":"if isinstance(strategy, SparkDeskRagStrategy):\n    raise UnsupportedBackendError(\"chunk deletion not available for SparkDesk-RAG\")","typeGuard":"def is_sparkdesk(strategy) -> bool:\n    return isinstance(strategy, SparkDeskRagStrategy)","tryCatchPattern":"try:\n    await strategy.chunks_delete(docId, chunkIds)\nexcept NotImplementedError:\n    await strategy.delete_document(docId)  # whole-doc fallback","preventionTips":["Gate chunk-level cleanup jobs by backend capability","Use document-level deletion for SparkDesk backends","Test pipelines against every configured backend type"],"tags":["python","rag","not-implemented","sparkdesk"],"backgroundTag":"unsupported-operation","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}