{"record":{"id":"6664324bc58dee9a","repo":"ScrapeGraphAI/Scrapegraph-ai","slug":"invalid-input-type-input-type","errorCode":null,"errorMessage":"Invalid input type: {input_type}","messagePattern":"Invalid input type: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"scrapegraphai/nodes/fetch_node.py","lineNumber":126,"sourceCode":"            \"xml_dir\": self.handle_directory,\n            \"csv_dir\": self.handle_directory,\n            \"pdf_dir\": self.handle_directory,\n            \"md_dir\": self.handle_directory,\n            \"pdf\": self.handle_file,\n            \"csv\": self.handle_file,\n            \"json\": self.handle_file,\n            \"xml\": self.handle_file,\n            \"md\": self.handle_file,\n        }\n\n        if input_type in handlers:\n            return handlers[input_type](state, input_type, source)\n        elif input_type == \"local_dir\":\n            return self.handle_local_source(state, source)\n        elif input_type == \"url\":\n            return self.handle_web_source(state, source)\n        else:\n            raise ValueError(f\"Invalid input type: {input_type}\")\n\n    def handle_directory(self, state, input_type, source):\n        \"\"\"\n        Handles the directory by compressing the source document and updating the state.\n\n        Parameters:\n        state (dict): The current state of the graph.\n        input_type (str): The type of input being processed.\n        source (str): The source document to be compressed.\n\n        Returns:\n        dict: The updated state with the compressed document.\n        \"\"\"\n\n        compressed_document = [source]\n        state.update({self.output[0]: compressed_document})\n        return state\n","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/ScrapeGraphAI/Scrapegraph-ai/blob/532dfffbf6ee823a6c9cf8cfedc24a93bf026780/scrapegraphai/nodes/fetch_node.py#L108-L144","documentation":"FetchNode.execute dispatches on input_type: registered handlers, then 'local_dir', then 'url'; anything else falls through to this ValueError. input_type is typically derived from the source (a URL vs a path), so an unrecognized source format produces this error.","triggerScenarios":"Passing a source string that is neither a URL, existing local path, directory, nor a registered file type — e.g. a malformed scheme like 'ftp://...' or a typo'd input key. Also when 'input_type' in state/config is set to an unsupported value.","commonSituations":"Wrong 'input' source key in the graph config; passing s3:// or other unsupported schemes; state accidentally containing an input_type value set by a custom upstream node.","solutions":["Check what input_type is resolved to (log it) and fix the source to a supported type: 'url', 'local_dir', or a recognized file/directory path","Ensure the graph config's 'source' points to a valid http(s) URL or local path","If using a custom source type, register an appropriate handler or preprocess the source into HTML first"],"exampleFix":"# before\ngraph_config = {'source': 'ftp://example.com/doc'}\n# after\ngraph_config = {'source': 'https://example.com/doc'}","handlingStrategy":"validation","validationCode":"from urllib.parse import urlparse\nSUPPORTED = ('http', 'https')\ndef source_ok(src: str) -> bool:\n    u = urlparse(src)\n    return u.scheme in SUPPORTED or (not u.scheme and Path(src).exists())","typeGuard":"def is_fetchable_source(s: str) -> bool:\n    return s.startswith(('http://','https://')) or os.path.exists(s)","tryCatchPattern":"try:\n    node.execute(state)\nexcept ValueError as e:\n    if 'Invalid input type' in str(e):\n        raise ValueError(f'unsupported source: {state.get(\"source\")!r}') from e\n    raise","preventionTips":["Normalize sources to http(s) URLs or verified local paths before graph run","Reject schemes like ftp:// in your orchestration layer"],"tags":["scrapegraphai","fetch-node","input-type","dispatch"],"backgroundTag":"unsupported-input-type","analyzedSha":"532dfffbf6ee823a6c9cf8cfedc24a93bf026780","analyzedAt":"2026-08-28T15:19:38.821Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}