{"record":{"id":"e6d662a2713f93ab","repo":"iflytek/astron-agent","slug":"chunkupdatefailed","errorCode":"ChunkUpdateFailed","errorMessage":"Unable to resolve RAGFlow dataset for chunks_update","messagePattern":"Unable to resolve RAGFlow dataset for chunks_update","errorType":"error_code","errorClass":"CustomException","httpStatus":null,"severity":"error","filePath":"core/knowledge/service/impl/ragflow_strategy.py","lineNumber":840,"sourceCode":"            return await self._handle_chunk_results(\n                saved_chunks, failed_chunks, chunks_typed\n            )\n\n        except CustomException:\n            raise  # Re-raise custom exceptions to be handled by API layer\n        except Exception as e:\n            logger.error(f\"Chunk save operation failed: {e}\")\n            raise CustomException(CodeEnum.ChunkSaveFailed, str(e))\n\n    async def _validate_chunks_update_config(\n        self, dataset_id: Optional[str] = None\n    ) -> str:\n        \"\"\"Resolve dataset for chunks_update.\"\"\"\n        resolved = await self._resolve_dataset_id(dataset_id)\n        if not resolved:\n            err = \"Unable to resolve RAGFlow dataset for chunks_update\"\n            logger.error(err)\n            raise CustomException(CodeEnum.ChunkUpdateFailed, err)\n        return resolved\n\n    async def _process_chunk_update(\n        self,\n        chunk: Dict,\n        dataset_id: str,\n        doc_id: str,\n        failed_chunks: Dict,\n        successful_count: int,\n    ) -> int:\n        \"\"\"Process update of single chunk\"\"\"\n        chunk_id = (\n            chunk.get(\"chunkId\")\n            or chunk.get(\"dataIndex\")\n            or chunk.get(\"chunk_id\")\n            or chunk.get(\"id\")\n        )\n","sourceCodeStart":822,"sourceCodeEnd":858,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/service/impl/ragflow_strategy.py#L822-L858","documentation":"Same resolution failure as chunks_save but on the update path: _validate_chunks_update_config could not determine the RAGFlow dataset for chunks_update, so it raises ChunkUpdateFailed with a path-specific message.","triggerScenarios":"chunks_update called with dataset_id=None and no resolvable fallback (missing KB mapping, deleted dataset, absent config).","commonSituations":"Knowledge base's RAGFlow dataset deleted or recreated; environment migrated to a new RAGFlow instance without updating dataset IDs; update job scheduled with stale identifiers.","solutions":["Pass an explicit dataset_id to chunks_update.","Rebuild the knowledge base -> RAGFlow dataset mapping (verify via RAGFlow list-datasets).","Confirm RAGFlow connection config so resolution can query the right instance.","Re-ingest/rebind the document if its dataset no longer exists."],"exampleFix":"// before\nawait strategy.chunks_update(docId=doc_id, chunkId=cid, content=new_text)  # no dataset\n// after\ndataset_id = await kb_service.get_ragflow_dataset_id(kb_id)\nawait strategy.chunks_update(docId=doc_id, chunkId=cid, content=new_text, dataset_id=dataset_id)","handlingStrategy":"validation","validationCode":"resolved = await strategy._resolve_dataset_id(dataset_id)\nif not resolved:\n    raise ValueError(\"cannot update chunks without a RAGFlow dataset\")\nawait strategy.chunks_update(docId=doc_id, chunkId=cid, content=new_text, dataset_id=dataset_id)","typeGuard":null,"tryCatchPattern":"try:\n    await strategy.chunks_update(docId=doc_id, chunkId=cid, content=new_text, dataset_id=ds)\nexcept CustomException as e:\n    if \"Unable to resolve RAGFlow dataset for chunks_update\" in str(e):\n        rebind_dataset_then_retry(kb_id, doc_id, cid, new_text)\n    else:\n        raise","preventionTips":["Pass dataset_id explicitly on every update call.","Reconcile KB-dataset bindings periodically against RAGFlow.","Fail fast with a clear message when a binding is missing."],"tags":["ragflow","dataset","chunks-update","configuration"],"backgroundTag":"resource-not-found","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"}