{"record":{"id":"8db786826b04b145","repo":"iflytek/astron-agent","slug":"file-chunking-processing-failed-str-e","errorCode":null,"errorMessage":"File chunking processing failed: {str(e)}","messagePattern":"File chunking processing failed: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"core/knowledge/service/impl/ragflow_strategy.py","lineNumber":459,"sourceCode":"                except Exception:\n                    logger.exception(\n                        \"RAGFlow first-upload ingestion failed, rolling back %s\",\n                        doc_id,\n                    )\n                    await self._safe_delete_document(dataset_id, doc_id, log_only=True)\n                    raise\n\n            # Step 7: Convert to standard format\n            result = RagflowUtils.convert_to_standard_format(doc_id, chunks_data)\n\n            logger.info(\"Split processing completed, returning %d chunks\", len(result))\n            return result\n\n        except (CustomException, ThirdPartyException):\n            raise\n        except Exception as e:\n            logger.error(\"Split operation failed: %s\", e)\n            raise ValueError(f\"File chunking processing failed: {str(e)}\") from e\n\n    def _create_error_chunk(\n        self, error_id: str, dataset_id: str, doc_id: str, content: str\n    ) -> Dict[str, Any]:\n        \"\"\"Create error format chunk\"\"\"\n        return {\n            \"id\": error_id,\n            \"datasetId\": dataset_id,\n            \"fileId\": doc_id,\n            \"createTime\": time.strftime(\"%Y-%m-%d %H:%M:%S\"),\n            \"updateTime\": time.strftime(\"%Y-%m-%d %H:%M:%S\"),\n            \"chunkType\": \"RAW\",\n            \"content\": content,\n            \"question\": None,\n            \"answer\": None,\n            \"dataIndex\": error_id,\n            \"imgReference\": None,\n            \"copiedFrom\": None,","sourceCodeStart":441,"sourceCodeEnd":477,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/service/impl/ragflow_strategy.py#L441-L477","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the chained cause (__cause__) and the 'Split operation failed' log line to find the real underlying exception.","Verify fileUrl is reachable from the knowledge service (network policy, DNS, auth headers) before calling split.","Check RAGFlow service health — connection-refused/timeouts during upload or parse surface here.","If the cause is a conversion bug, add a test against the actual chunk payload shape returned by get_document_chunks.","Wrap known-failure points (file fetch, conversion) with explicit typed exceptions so callers get precise errors instead of this catch-all."],"exampleFix":"// before: unreachable URL produces opaque ValueError\nchunks = await strategy.split(fileUrl=\"https://internal-host/file.pdf\")\n\n// after: pre-flight check with clear error\nimport aiohttp\ntry:\n    async with aiohttp.ClientSession() as s:\n        async with s.head(fileUrl, timeout=aiohttp.ClientTimeout(total=10)) as r:\n            r.raise_for_status()\nexcept Exception as e:\n    raise ValueError(f\"fileUrl not reachable: {fileUrl}\") from e\nchunks = await strategy.split(fileUrl=fileUrl)","handlingStrategy":"try-catch","validationCode":"# pre-flight: URL reachable and non-empty\nimport aiohttp\nasync with aiohttp.ClientSession() as s:\n    async with s.head(fileUrl, timeout=aiohttp.ClientTimeout(total=10)) as r:\n        if r.status >= 400:\n            raise ValueError(f\"fileUrl returned {r.status}\")","typeGuard":"def is_reachable_url(fileUrl) -> bool:\n    from urllib.parse import urlparse\n    p = urlparse(fileUrl)\n    return p.scheme in (\"http\", \"https\") and bool(p.netloc)","tryCatchPattern":"try:\n    chunks = await strategy.split(fileUrl=url, **kwargs)\nexcept ValueError as e:\n    cause = e.__cause__\n    logger.error(\"split pipeline failed: %s caused by %r\", e, cause)\n    if isinstance(cause, aiohttp.ClientError):\n        raise RetryableSplitError(str(e)) from e\n    raise","preventionTips":["Pre-flight check fileUrl reachability/credentials before split.","Inspect e.__cause__ and the 'Split operation failed' log to find the real error.","Convert known failure modes (fetch, conversion) into typed exceptions upstream.","Set client timeouts appropriate for large files to avoid mid-pipeline aborts."],"tags":["ragflow","chunking","catch-all","pipeline"],"backgroundTag":"http-request-failed","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"}