I’m using the com.google.genai:google-genai:1.9.0
SDK in a Spring Boot Java project.
I’m trying to upload a file, but I keep encountering the following error:
“Failed to create file. Upload URL was not returned in the create file response.”
After debugging, I realized that this error occurs because the SDK checks for the response header 'X-Goog-Upload-URL'
, but the actual header returned by the GenAI API is 'x-goog-upload-url'
(all lowercase). Since the Java Map is case-sensitive , the check in line#892:
.containsKey("X-Goog-Upload-URL")
fails, and the upload URL is not found, triggering the error on line #894.