iflytek/astron-agent · error · CustomException

ChunkUpdateFailed

ChunkUpdateFailed

Error message

Unable to resolve RAGFlow dataset for chunks_update

What it means

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.

Solutions

  1. Pass an explicit dataset_id to chunks_update.
  2. Rebuild the knowledge base -> RAGFlow dataset mapping (verify via RAGFlow list-datasets).
  3. Confirm RAGFlow connection config so resolution can query the right instance.
  4. Re-ingest/rebind the document if its dataset no longer exists.

Example fix

// before
await strategy.chunks_update(docId=doc_id, chunkId=cid, content=new_text)  # no dataset
// after
dataset_id = await kb_service.get_ragflow_dataset_id(kb_id)
await strategy.chunks_update(docId=doc_id, chunkId=cid, content=new_text, dataset_id=dataset_id)
Defensive patterns

Strategy: validation

Validate before calling

resolved = await strategy._resolve_dataset_id(dataset_id)
if not resolved:
    raise ValueError("cannot update chunks without a RAGFlow dataset")
await strategy.chunks_update(docId=doc_id, chunkId=cid, content=new_text, dataset_id=dataset_id)

Try / catch

try:
    await strategy.chunks_update(docId=doc_id, chunkId=cid, content=new_text, dataset_id=ds)
except CustomException as e:
    if "Unable to resolve RAGFlow dataset for chunks_update" in str(e):
        rebind_dataset_then_retry(kb_id, doc_id, cid, new_text)
    else:
        raise

Prevention

When it happens

Trigger: chunks_update called with dataset_id=None and no resolvable fallback (missing KB mapping, deleted dataset, absent config).

Common situations: 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.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at core/knowledge/service/impl/ragflow_strategy.py:840

            return await self._handle_chunk_results(
                saved_chunks, failed_chunks, chunks_typed
            )

        except CustomException:
            raise  # Re-raise custom exceptions to be handled by API layer
        except Exception as e:
            logger.error(f"Chunk save operation failed: {e}")
            raise CustomException(CodeEnum.ChunkSaveFailed, str(e))

    async def _validate_chunks_update_config(
        self, dataset_id: Optional[str] = None
    ) -> str:
        """Resolve dataset for chunks_update."""
        resolved = await self._resolve_dataset_id(dataset_id)
        if not resolved:
            err = "Unable to resolve RAGFlow dataset for chunks_update"
            logger.error(err)
            raise CustomException(CodeEnum.ChunkUpdateFailed, err)
        return resolved

    async def _process_chunk_update(
        self,
        chunk: Dict,
        dataset_id: str,
        doc_id: str,
        failed_chunks: Dict,
        successful_count: int,
    ) -> int:
        """Process update of single chunk"""
        chunk_id = (
            chunk.get("chunkId")
            or chunk.get("dataIndex")
            or chunk.get("chunk_id")
            or chunk.get("id")
        )

View on GitHub (pinned to 5e758547a8)