iflytek/astron-agent · error · ValueError

File chunking processing failed

Error message

File chunking processing failed: {str(e)}

What it means

Catch-all wrapper at the end of split() (core/knowledge/service/impl/ragflow_strategy.py:459). Any unexpected exception during the split pipeline (dataset resolution, upload, parsing, chunk fetch, format conversion) that is not a CustomException or ThirdPartyException is re-raised as ValueError('File chunking processing failed: ...') with the original as __cause__. It marks an unclassified, most likely local/programming or transport failure in the chunking workflow.

Solutions

  1. Inspect the chained cause (__cause__) and the 'Split operation failed' log line to find the real underlying exception.
  2. Verify fileUrl is reachable from the knowledge service (network policy, DNS, auth headers) before calling split.
  3. Check RAGFlow service health — connection-refused/timeouts during upload or parse surface here.
  4. If the cause is a conversion bug, add a test against the actual chunk payload shape returned by get_document_chunks.
  5. Wrap known-failure points (file fetch, conversion) with explicit typed exceptions so callers get precise errors instead of this catch-all.

Example fix

// before: unreachable URL produces opaque ValueError
chunks = await strategy.split(fileUrl="https://internal-host/file.pdf")

// after: pre-flight check with clear error
import aiohttp
try:
    async with aiohttp.ClientSession() as s:
        async with s.head(fileUrl, timeout=aiohttp.ClientTimeout(total=10)) as r:
            r.raise_for_status()
except Exception as e:
    raise ValueError(f"fileUrl not reachable: {fileUrl}") from e
chunks = await strategy.split(fileUrl=fileUrl)
Defensive patterns

Strategy: try-catch

Validate before calling

# pre-flight: URL reachable and non-empty
import aiohttp
async with aiohttp.ClientSession() as s:
    async with s.head(fileUrl, timeout=aiohttp.ClientTimeout(total=10)) as r:
        if r.status >= 400:
            raise ValueError(f"fileUrl returned {r.status}")

Type guard

def is_reachable_url(fileUrl) -> bool:
    from urllib.parse import urlparse
    p = urlparse(fileUrl)
    return p.scheme in ("http", "https") and bool(p.netloc)

Try / catch

try:
    chunks = await strategy.split(fileUrl=url, **kwargs)
except ValueError as e:
    cause = e.__cause__
    logger.error("split pipeline failed: %s caused by %r", e, cause)
    if isinstance(cause, aiohttp.ClientError):
        raise RetryableSplitError(str(e)) from e
    raise

Prevention

When it happens

Trigger: Calling split() when RagflowUtils.process_file raises (unreadable URL/file, download failure), ragflow_client raises a transport exception (timeout, connection refused), convert_to_standard_format hits an unexpected chunk shape, or any non-typed exception escapes the inner try blocks.

Common situations: fileUrl points to an unreachable URL or requires auth; network partition between knowledge service and RAGFlow mid-pipeline; bug in a RagflowUtils helper after a refactor; request timeout on a very large file; exceptions raised inside except/finally handlers that bypass the typed re-raise branches.

Understand the failure class

Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.

Related errors


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

Appendix: source

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

                except Exception:
                    logger.exception(
                        "RAGFlow first-upload ingestion failed, rolling back %s",
                        doc_id,
                    )
                    await self._safe_delete_document(dataset_id, doc_id, log_only=True)
                    raise

            # Step 7: Convert to standard format
            result = RagflowUtils.convert_to_standard_format(doc_id, chunks_data)

            logger.info("Split processing completed, returning %d chunks", len(result))
            return result

        except (CustomException, ThirdPartyException):
            raise
        except Exception as e:
            logger.error("Split operation failed: %s", e)
            raise ValueError(f"File chunking processing failed: {str(e)}") from e

    def _create_error_chunk(
        self, error_id: str, dataset_id: str, doc_id: str, content: str
    ) -> Dict[str, Any]:
        """Create error format chunk"""
        return {
            "id": error_id,
            "datasetId": dataset_id,
            "fileId": doc_id,
            "createTime": time.strftime("%Y-%m-%d %H:%M:%S"),
            "updateTime": time.strftime("%Y-%m-%d %H:%M:%S"),
            "chunkType": "RAW",
            "content": content,
            "question": None,
            "answer": None,
            "dataIndex": error_id,
            "imgReference": None,
            "copiedFrom": None,

View on GitHub (pinned to 5e758547a8)