GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — storage: "Failed to parse Content-Range header" when chunk-size upload is used · Issue #720 · googleapis/google-cloud-java

storage: "Failed to parse Content-Range header" when chunk-size upload is used #720

New issue
Copy link
New issue
Copy link
Closed
Closed
storage: "Failed to parse Content-Range header" when chunk-size upload is used#720
Copy link
Assignees
mziccard
Labels
api: storageIssues related to the Cloud Storage API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@sudison
sudison
opened on Mar 7, 2016
Issue body actions

Here is the log:

Caused by: com.google.gcloud.storage.StorageException: 400 Bad Request
Failed to parse Content-Range header.
at com.google.gcloud.spi.DefaultStorageRpc.translate(DefaultStorageRpc.java:94)
at com.google.gcloud.spi.DefaultStorageRpc.write(DefaultStorageRpc.java:499)
at com.google.gcloud.storage.BlobWriteChannel$1.run(BlobWriteChannel.java:49)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at com.google.gcloud.RetryHelper.doRetry(RetryHelper.java:181)
at com.google.gcloud.RetryHelper.runWithRetries(RetryHelper.java:247)
at com.google.gcloud.RetryHelper.runWithRetries(RetryHelper.java:237)
at com.google.gcloud.storage.BlobWriteChannel.flushBuffer(BlobWriteChannel.java:46)
at com.google.gcloud.BaseWriteChannel.close(BaseWriteChannel.java:147)

If I uploaded a file with size is exactly 2 x 1024 x 1024, and 1024 x 1024 as the chunk size, then I'll get above exception. However, if I changed the file size to 2 x 1024 x 1024 + 1, then the problem will go away.

Apparently, there is a bug in BlobWriteChannel->flushbuffer, if there is no data available, then there is no need to call options().rpc().write.

Activity

Next
  1. mziccard commented on Mar 7, 2016

    @mziccard
    mziccard
    on Mar 7, 2016
    Contributor
    More actions

    Hi @sudison thanks for the report. I managed to reproduce you issue, I will look into this and provide a fix as soon as possible.

  2. aozarov
    added
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    api: storageIssues related to the Cloud Storage API.
    on Mar 7, 2016
  3. jean-philippe-martin commented on Mar 7, 2016

    @jean-philippe-martin
    jean-philippe-martin
    on Mar 7, 2016
    More actions

    PR #714 has a potential fix for that, making a note to try the repro after that request is merged.

  4. sudison commented on Mar 7, 2016

    @sudison
    sudison
    on Mar 7, 2016
    Author
    More actions

    I tried the fix in jean-philippe-martin@73b9ef6, I got

    com.google.api.client.http.HttpResponseException: 400 Bad Request
    {
    "error": {
    "errors": [
    {
    "domain": "global",
    "reason": "badRequest",
    "message": "Invalid Upload Request"
    }
    ],
    "code": 400,
    "message": "Invalid Upload Request"
    }
    }

    if length is zero, sending a upload request to cloud storage, will get above exception.

    Reacted by chulman444
  5. aozarov commented on Mar 7, 2016

    @aozarov
    aozarov
    on Mar 7, 2016
    Contributor
    More actions

    Yes, @sudison thank you. We realized that but unfortunately only added a comment in the PR and not here. We are waiting to see if there is a good way to fix that other than applying a workaround to fix it.

  6. sudison commented on Mar 7, 2016

    @sudison
    sudison
    on Mar 7, 2016
    Author
    More actions

    My fix for this issue is to add a method:
    void totalLength(long length);
    on WriteChannel.
    The assumption is that, caller knows the length of the file before uploading to GCS.

  7. aozarov commented on Mar 7, 2016

    @aozarov
    aozarov
    on Mar 7, 2016
    Contributor
    More actions

    Indeed that is a way, but I don't think we should make knowing the total lengths a requirement (and GCS should be able to support it). There are various cases where one would not know the length and we would like to support them to.

  8. jean-philippe-martin commented on Mar 7, 2016

    @jean-philippe-martin
    jean-philippe-martin
    on Mar 7, 2016
    More actions

    Agreed. Having to specify the length would make Java NIO integration really hard as NIO users don't give the length before starting their writes via e.g. newOutputStream.

  9. sudison commented on Mar 7, 2016

    @sudison
    sudison
    on Mar 7, 2016
    Author
    More actions

    As a user, if I want to use this library now, what should I do? This is the basic requirement for a library which can upload/download a file.

  10. aozarov commented on Mar 7, 2016

    @aozarov
    aozarov
    on Mar 7, 2016
    Contributor
    More actions

    We will fix it soon. How big is your Blob? Can you apply one of the create methods that takes the blob content in the meantime?

  11. sudison commented on Mar 7, 2016

    @sudison
    sudison
    on Mar 7, 2016
    Author
    More actions

    Ok, thanks. Blob is around 1 - 20 MB. Is create method ok for such blob?

  12. aozarov commented on Mar 7, 2016

    @aozarov
    aozarov
    on Mar 7, 2016
    Contributor
    More actions

    20MB is on the bigger side but Yes, and you can use the create that accepts InputStream if you don't have the content in memory.

  13. sudison commented on Mar 7, 2016

    @sudison
    sudison
    on Mar 7, 2016
    Author
    More actions

    ok, thanks. then I'll use create for now.

  14. mziccard
    closed this as completedin #725on Mar 8, 2016
  15. 19 remaining items

  16. github-actions
    added a commit that references this issue on Oct 6, 2022

    chore(main): release 2.1.8 (#738)

    f000d2f
  17. suztomo
    added a commit that references this issue on Feb 1, 2023

    chore: fix link to documentation (#720)

    0461594
  18. meltsufin
    added a commit that references this issue on Dec 22, 2025

    feat: Add destination property into LogEntry (#720)

    43ea0b4
  19. chingor13
    added a commit that references this issue on Jan 6, 2026

    chore(deps): update dependency com.google.cloud:libraries-bom to v25 (#…

    493c14a
  20. chingor13
    added a commit that references this issue on Feb 24, 2026

    chore(deps): update dependency com.google.appengine:appengine to v1.9…

    6efc6d0
  21. suztomo
    added a commit that references this issue on Mar 11, 2026

    feat: Add destination property into LogEntry (googleapis#720)

    b63e764
  22. chingor13
    added a commit that references this issue on Mar 12, 2026

    chore(deps): update dependency com.google.appengine:appengine to v1.9…

    5315c3c
  23. suztomo
    added 2 commits that reference this issue on Mar 23, 2026

    fix(java): replace excludedGroup with exclude (googleapis#720)

    02e4731

    chore(main): release 2.5.9 (googleapis#721)

    7dfbd4e
  24. suztomo
    added 2 commits that reference this issue on Mar 30, 2026

    deps: update dependency com.google.guava:guava to v31 (#720)

    8813073

    chore: release 0.123.14 (#728)

    8ea8dcb
  25. lqiu96
    added 2 commits that reference this issue on Apr 1, 2026

    deps: update dependency com.google.guava:guava to v31 (#720)

    c5614e4

    chore: release 0.123.14 (#728)

    815ee2f
  26. meltsufin
    added 2 commits that reference this issue on Apr 29, 2026

    chore: minimize noise from build scripts (#720)

    a7daeed

    chore: minimize noise from build scripts (#720)

    9c6785d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @mziccard
    mziccard

Labels

api: storageIssues related to the Cloud Storage API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.