{"record":{"id":"155d49c0547d8398","repo":"iflytek/astron-agent","slug":"sparkdesk-rag-does-not-support-query-doc-operation","errorCode":null,"errorMessage":"SparkDesk-RAG does not support query_doc operation.","messagePattern":"SparkDesk-RAG does not support query_doc operation\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"core/knowledge/service/impl/sparkdesk_strategy.py","lineNumber":159,"sourceCode":"        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.\")\n\n    async def query_doc_name(self, docId: str, **kwargs: Any) -> Optional[dict]:\n        \"\"\"\n        Query document name information\n\n        Args:\n            doc_id: Document ID\n            **kwargs: Other parameters\n\n        Returns:\n            File information object\n\n        Raises:\n            NotImplementedError: SparkDesk-RAG does not support document name query operation\n        \"\"\"\n        raise NotImplementedError(\n            \"SparkDesk-RAG does not support query_doc_name operation.\"\n        )","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/service/impl/sparkdesk_strategy.py#L141-L177","documentation":"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.","triggerScenarios":"Calling query_doc(docId) on a SparkDesk-RAG strategy to enumerate a document's chunks.","commonSituations":"Document-detail views or chunk listings that call the strategy generically, then fail when the configured backend is SparkDesk.","solutions":["Track chunk metadata locally (DB) instead of querying SparkDesk for it","Return an empty/disabled result for SparkDesk backends after an explicit capability check","Implement query_doc if SparkDesk adds a chunk-listing endpoint"],"exampleFix":"// before\nchunks = await strategy.query_doc(docId)\n// after\nchunks = [] if isinstance(strategy, SparkDeskRagStrategy) else await strategy.query_doc(docId)","handlingStrategy":"try-catch","validationCode":"def can_query_doc(strategy) -> bool:\n    return not isinstance(strategy, SparkDeskRagStrategy)","typeGuard":"def is_sparkdesk(strategy) -> bool:\n    return isinstance(strategy, SparkDeskRagStrategy)","tryCatchPattern":"try:\n    chunks = await strategy.query_doc(docId)\nexcept NotImplementedError:\n    chunks = []  # backend cannot enumerate chunks","preventionTips":["Persist chunk listings in local storage at upload time","Return empty chunk lists rather than crashing for SparkDesk","Add per-backend capability checks in document-detail endpoints"],"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"}