{"record":{"id":"91e750b1410c7328","repo":"iflytek/astron-agent","slug":"unsupported-file-input-file-input-only-http-https-urls-are","errorCode":null,"errorMessage":"Unsupported file input: {file_input}. Only HTTP/HTTPS URLs are supported for string input.","messagePattern":"Unsupported file input: (.+?)\\. Only HTTP/HTTPS URLs are supported for string input\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"core/knowledge/infra/ragflow/ragflow_utils.py","lineNumber":277,"sourceCode":"        return file_content, filename\n\n    @staticmethod\n    async def process_file(file_input: Union[str, UploadFile]) -> tuple[bytes, str]:\n        \"\"\"\n        Process file (download, read local file, or handle upload file)\n\n        Args:\n            file_input: File path/URL (str) or UploadFile object\n\n        Returns:\n            (file content, filename)\n        \"\"\"\n        if isinstance(file_input, str):\n            # URL logic: only support HTTP/HTTPS URLs\n            if file_input.startswith((\"http://\", \"https://\")):\n                return await RagflowUtils._download_url_file(file_input)\n            else:\n                raise ValueError(\n                    f\"Unsupported file input: {file_input}. \"\n                    \"Only HTTP/HTTPS URLs are supported for string input.\"\n                )\n        else:\n            # Handle UploadFile objects\n            file_content = await file_input.read()\n            filename = file_input.filename or \"uploaded_file\"\n\n            logger.info(\n                \"Processing uploaded file: %s, size: %d bytes\",\n                filename,\n                len(file_content),\n            )\n\n            if len(file_content) == 0:\n                raise Exception(\"Uploaded file is empty\")\n\n            # Reset file pointer for potential future reads","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/core/knowledge/infra/ragflow/ragflow_utils.py#L259-L295","documentation":"process_file raises when a string file_input is neither an http:// nor https:// URL (e.g. a bare path, ftp://, or data: URI). The generic input guard only supports HTTP(S) URLs for string input; UploadFile objects take the other branch.","triggerScenarios":"Thrown at core/knowledge/infra/ragflow/ragflow_utils.py:277 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass full http/https URLs for remote files","Use the UploadFile path for local uploads","Pre-normalize/whitelist supported URL schemes before calling"],"exampleFix":null,"handlingStrategy":"validation","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"}