xtekky/gpt4free · error · ValueError
Unsupported file type: {filename}
Error message
Unsupported file type: {filename} What it means
Error "Unsupported file type: {filename}" thrown in xtekky/gpt4free.
Source
Thrown at g4f/gui/server/backend_api.py:899
width, height = process_image(
image, save=os.path.join(thumbnail_dir, filename)
)
image_size = {"width": width, "height": height}
except UnidentifiedImageError:
pass
except Exception as e:
logger.exception(e)
if result:
media.append({"name": filename, "text": result, **image_size})
else:
media.append({"name": filename, **image_size})
elif is_supported and not result:
newfile = os.path.join(bucket_dir, filename)
filenames.append(filename)
else:
os.remove(copyfile)
if not result:
raise ValueError(f"Unsupported file type: {filename}")
continue
try:
os.rename(copyfile, newfile)
except OSError:
shutil.copyfile(copyfile, newfile)
os.remove(copyfile)
with open(
os.path.join(bucket_dir, "files.txt"), "w", encoding="utf-8"
) as f:
for filename in filenames:
f.write(f"{filename}\n")
return {"bucket_id": bucket_id, "files": filenames, "media": media}
@app.route("/files/<bucket_id>/<file_type>/<filename>", methods=["GET"])
def get_media(bucket_id, file_type: str, filename, dirname: str = None):
if file_type not in ["media", "thumbnail"]:
return jsonify({"error": {"message": "Invalid file type"}}), 400
if file_type == "thumbnail":View on GitHub (pinned to 973504e177)
Solutions
- Upload a file with a supported extension.
- Check the allowed file types in the backend API.
When it happens
Trigger: Thrown at g4f/gui/server/backend_api.py:899 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of xtekky/gpt4free@973504e177 (2026-08-14).
Data as JSON: /api/errors/6654010e1a9b87ac.
Report an issue: GitHub.