iflytek/astron-agent · error · NotImplementedError

SparkDesk-RAG does not support query_doc operation.

Error message

SparkDesk-RAG does not support query_doc operation.

What it means

SparkDeskRagStrategy.query_doc() is an intentional stub raising NotImplementedError. SparkDesk-RAG does not provide an endpoint to list all chunks of a document, so this RagStrategy interface method is left unimplemented.

Solutions

  1. Track chunk metadata locally (DB) instead of querying SparkDesk for it
  2. Return an empty/disabled result for SparkDesk backends after an explicit capability check
  3. Implement query_doc if SparkDesk adds a chunk-listing endpoint

Example fix

// before
chunks = await strategy.query_doc(docId)
// after
chunks = [] if isinstance(strategy, SparkDeskRagStrategy) else await strategy.query_doc(docId)
Defensive patterns

Strategy: try-catch

Validate before calling

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

Type guard

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

Try / catch

try:
    chunks = await strategy.query_doc(docId)
except NotImplementedError:
    chunks = []  # backend cannot enumerate chunks

Prevention

When it happens

Trigger: Calling query_doc(docId) on a SparkDesk-RAG strategy to enumerate a document's chunks.

Common situations: Document-detail views or chunk listings that call the strategy generically, then fail when the configured backend is SparkDesk.

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/155d49c0547d8398. Report an issue: GitHub.

Appendix: source

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

        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.")

    async def query_doc_name(self, docId: str, **kwargs: Any) -> Optional[dict]:
        """
        Query document name information

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

        Returns:
            File information object

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

View on GitHub (pinned to 5e758547a8)