-1

I want to upload a file to my blob storage (text_vi.csv). I always get an error after 4 seconds: specified blob is invalid. I renamed the file to "text_vie.csv" and it works now. Any idea why this is? I really want to keep text_vi.csv because all other files have the same structure.

8
  • Could you explain how you are uploading the file? if code please provide me code? Commented Jun 17 at 8:35
  • @Venkatesan via the Azure Storage Explorer. And as said, all other files work, larger files, smaller files, but somehow the 'vi' makes the upload to fail... Commented Jun 17 at 9:22
  • Could you please add the error screenshot or image link here ?. Commented Jun 17 at 9:22
  • @Venkatesan unfortunately I can not provide a screenshot right now because I am on another machine but I will try to get one. I only have the error code: InvalidBlobOrBlock (Bad Request 400) 'filename' Upload failed after 4 seconds. Commented Jun 17 at 9:28
  • The error is not with the filename; the file format is incorrect. Please refer to this learn.microsoft.com/en-us/troubleshoot/azure/azure-storage/…. Commented Jun 17 at 10:47

1 Answer 1

0

InvalidBlobOrBlock (Bad Request 400) 'filename' Upload failed after 4 seconds.

According to this MS-Document,

This issue is not related to the filename itself, but likely due to encoding, locale settings, or file metadata being misinterpreted by Azure Storage Explorer.

Alternatively, try uploading the file with the same name using the Azure portal or via code.

Code:

from azure.storage.blob import BlobServiceClient

connection_string = "<your-connection-string>"
container_name = "your-container"
blob_name = "text_vi.csv"  # Keep original name
local_file_path = "text_vi.csv"

blob_service_client = BlobServiceClient.from_connection_string(connection_string)
blob_client = blob_service_client.get_blob_client(container=container_name, blob=blob_name)

with open(local_file_path, "rb") as data:
    blob_client.upload_blob(data, overwrite=True)

print("Upload succeeded!")

Because I tried another name file (embeddings_vi.csv) and it didn't work too. Only after I renamed it to embeddings_vie.csv. But thanks a lot I'll just change the other names to be 3 chars after the underscore for now.

As you mentioned, this is unusual, and your workaround of using 3+ characters after _ is completely valid. However, if you want a definitive answer or resolution, I suggest raising an issue on GitHub link.

Note: Use the latest version of Microsoft Azure storage explorer.

Reference:

Upload a blob with Python - Azure Storage | Microsoft Learn

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.