iflytek/astron-agent · error · NotImplementedError

SparkDesk-RAG does not support chunks_delete operation.

Error message

SparkDesk-RAG does not support chunks_delete operation.

What it means

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.

Solutions

  1. Delete the whole document and re-upload without the unwanted content
  2. Disable or hide chunk deletion for SparkDesk-RAG backends in the caller
  3. Implement chunks_delete if SparkDesk later exposes a chunk-level delete API

Example fix

// before
await strategy.chunks_delete(docId, chunkIds)
// after
if isinstance(strategy, SparkDeskRagStrategy):
    await strategy.delete_document(docId)
else:
    await strategy.chunks_delete(docId, chunkIds)
Defensive patterns

Strategy: validation

Validate before calling

if isinstance(strategy, SparkDeskRagStrategy):
    raise UnsupportedBackendError("chunk deletion not available for SparkDesk-RAG")

Type guard

def is_sparkdesk(strategy) -> bool:
    return isinstance(strategy, SparkDeskRagStrategy)

Try / catch

try:
    await strategy.chunks_delete(docId, chunkIds)
except NotImplementedError:
    await strategy.delete_document(docId)  # whole-doc fallback

Prevention

When it happens

Trigger: Calling chunks_delete(docId, chunkIds) on a SparkDesk-RAG strategy, e.g. removing selected chunks from a knowledge-base document.

Common situations: Chunk-management features implemented for other RAG backends reused against SparkDesk-RAG; cleanup jobs deleting stale chunks.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/256e32e47c120b6e. Report an issue: GitHub.

Appendix: source

Thrown at core/knowledge/service/impl/sparkdesk_strategy.py:141

    async def chunks_delete(
        self, docId: str, chunkIds: List[str], **kwargs: Any
    ) -> Any:
        """
        Delete chunks

        Args:
            doc_id: Document ID
            chunk_ids: Chunk ID list
            **kwargs: Other parameters

        Returns:
            Delete result

        Raises:
            NotImplementedError: SparkDesk-RAG does not support delete operation
        """
        raise NotImplementedError(
            "SparkDesk-RAG does not support chunks_delete operation."
        )

    async def query_doc(self, docId: str, **kwargs: Any) -> List[dict]:
        """
        Query all chunks of a document

        Args:
            doc_id: Document ID
            **kwargs: Other parameters

        Returns:
            List of chunk information

        Raises:
            NotImplementedError: SparkDesk-RAG does not support document query operation
        """
        raise NotImplementedError("SparkDesk-RAG does not support query_doc operation.")

View on GitHub (pinned to 5e758547a8)