Error when verifying video upload state: File name may only contain lowercase alphanumeric characters or dashes (-) and cannot begin or end with a dash

Hey all, back again with more issues.

When running this code found in Gemini API docs:

while (file.state === FileState.PROCESSING) {
  process.stdout.write(".")
  // Sleep for 10 seconds
  await new Promise((resolve) => setTimeout(resolve, 10_000));
  // Fetch the file from the API again
  file = await fileManager.getFile(name)
}

I get this error:

Error transferring file: GoogleGenerativeAIFetchError: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/files/awsvideo.mp4: [400 Bad Request] * GetFileRequest.name: File name may only contain lowercase 
alphanumeric characters or dashes (-) and cannot begin or end with a dash.

The error its throwing makes me feel like it has something to do with the file extension. However, i tried removing it and ended up getting a different error:

Error transferring file: GoogleGenerativeAIFetchError: [GoogleGenerativeAI Error]: Error fetching from https://generativelanguage.googleapis.com/v1beta/files/awsvideo: [403 Forbidden] You do not have 
permission to access the File awsvideo or it may not exist.

The part sticking out here is

or it may not exist.

Could anyone help me figure out this error?

Hey, you are getting a 403 error, meaning you probably don’t have access. This seems to be an error on Google’s end with how they set this up.

1 Like

Im getting that 403 because generativelanguage.googleapis.com believes awsvideo doesnt exist because it doesnt have a file extension on it. So its right, the file without the extension doesnt exist. But it shows that file extension is not the problem here.

1 Like