{"record":{"id":"f0f89a9414e0df90","repo":"xtekky/gpt4free","slug":"unknown-or-unsupported-file-type","errorCode":null,"errorMessage":"Unknown or unsupported file type","messagePattern":"Unknown or unsupported file type","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"g4f/image/__init__.py","lineNumber":387,"sourceCode":"    elif binary_data.startswith(b\"\\x1a\\x45\\xdf\\xa3\"):\n        return \".mkv\", \"video/webm\"\n    elif binary_data.startswith(b\"\\x00\\x00\\x01\\xba\"):\n        return \".mpg\", \"video/mpeg\"\n\n    # ---- Text / Scripts ----\n    elif binary_data.lstrip().startswith(b\"#!\"):\n        return \".sh\", \"text/x-script\"\n    elif binary_data.lstrip().startswith((b\"{\", b\"[\")):\n        return \".json\", \"application/json\"\n    elif binary_data.lstrip().startswith((b\"<\", b\"<!DOCTYPE\")):\n        return \".html\", \"text/html\"\n    elif binary_data.lstrip().startswith(b\"<?xml\"):\n        return \".xml\", \"application/xml\"\n    elif all(32 <= b <= 127 or b in (9, 10, 13) for b in binary_data[:100]):\n        return \".txt\", \"text/plain\"\n\n    else:\n        raise ValueError(\"Unknown or unsupported file type\")\n\n\ndef extract_data_uri(data_uri: str) -> bytes:\n    \"\"\"\n    Extracts the binary data from the given data URI.\n\n    Args:\n        data_uri (str): The data URI.\n\n    Returns:\n        bytes: The extracted binary data.\n    \"\"\"\n    data = data_uri.split(\",\")[-1]\n    data = base64.b64decode(data)\n    return data\n\n\ndef process_image(","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/xtekky/gpt4free/blob/973504e1770928ed5fb82f43da528f441ad9ddc3/g4f/image/__init__.py#L369-L405","documentation":"Error \"Unknown or unsupported file type\" thrown in xtekky/gpt4free.","triggerScenarios":"Thrown at g4f/image/__init__.py:387 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a supported image file type (png, jpeg, gif, webp).","Verify the file extension and content are a real image."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"973504e1770928ed5fb82f43da528f441ad9ddc3","analyzedAt":"2026-08-14T23:45:32.408Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}