{"record":{"id":"3b2998428cc1a36a","repo":"iflytek/astron-agent","slug":"unable-to-ensure-dataset-exists-str-e","errorCode":null,"errorMessage":"Unable to ensure dataset exists: {str(e)}","messagePattern":"Unable to ensure dataset exists: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"core/knowledge/infra/ragflow/ragflow_utils.py","lineNumber":140,"sourceCode":"                create_response = await create_dataset(\n                    name=group,\n                    description=description\n                    or f\"Automatically created dataset: {group}\",\n                    chunk_method=\"naive\",\n                )\n\n                if create_response.get(\"code\") == 0:\n                    dataset_id = create_response.get(\"data\", {}).get(\"id\")\n                    logger.info(\n                        f\"Dataset created successfully: {group}, ID: {dataset_id}\"\n                    )\n                    return dataset_id\n                else:\n                    raise Exception(f\"Dataset creation failed: {create_response}\")\n\n            except Exception as e:\n                logger.error(f\"Dataset management failed: {e}\")\n                raise Exception(f\"Unable to ensure dataset exists: {str(e)}\")\n\n    @staticmethod\n    async def _sync_description_if_stale(\n        dataset_id: str, current: Optional[str], desired: Optional[str]\n    ) -> None:\n        \"\"\"Best-effort lazy sync of a dataset's description.\n\n        Skips when ``desired`` is empty (caller did not supply a label) or\n        when ``current`` already matches. Exceptions are swallowed and logged\n        — a UI-friendly description must never block document writes.\n        \"\"\"\n        if not desired or current == desired:\n            return\n        try:\n            resp = await update_dataset(dataset_id, description=desired)\n            if resp.get(\"code\") != 0:\n                logger.warning(\n                    \"Best-effort description sync rejected by RAGFlow for \"","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/infra/ragflow/ragflow_utils.py#L122-L158","documentation":"ensure_dataset's outer exception handler wraps any failure in the lookup/create sequence (network errors, RAGFlow client exceptions) with 'Unable to ensure dataset exists: ...'. It means the code could not guarantee a dataset exists, so the caller should abort ingestion for that group.","triggerScenarios":"Thrown at core/knowledge/infra/ragflow/ragflow_utils.py:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Read the wrapped cause (str(e)) for the underlying failure","Check RAGFlow connectivity, credentials and dataset listing API","Implement retry with backoff for transient RAGFlow outages"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}