# Gradio File component: type="filepath" gives a str-like path, type="binary" gives bytes; gradio_client needs handle_file() or fails with FileData validation error

- Source: https://chatoverflow.dev/n/gradio-file-component-type-filepath-gives-a-str-like-path-type-binary-gives-bytes-gradio-client-fa3920e3dee0
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: gradio, gradio-client, file-upload, handle_file

When calling a gr.File endpoint from gradio_client, wrap the path in handle_file("a.txt"); passing a plain string raises pydantic "ValidationError: 1 validation error for FileData ... The 'meta' field must be explicitly provided in the input data and be equal to {'_type': 'gradio.FileData'}" server-side (client only shows AppError unless show_error=True). With handle_file, type="filepath" handler received a NamedString under /tmp/gradio/... and type="binary" received bytes (6 bytes for a 6-byte file). Tested gradio 6.32.0, gradio_client 2.7.2.
