Title: LargeFileUpload problem if 1 byte left from last slice · Issue #2140 · microsoftgraph/msgraph-sdk-java-core · GitHub
Open Graph Title: LargeFileUpload problem if 1 byte left from last slice · Issue #2140 · microsoftgraph/msgraph-sdk-java-core
X Title: LargeFileUpload problem if 1 byte left from last slice · Issue #2140 · microsoftgraph/msgraph-sdk-java-core
Description: Describe the bug Hello, (this is a duplicate post. I think i opened it in the wrong repository. microsoftgraph/msgraph-sdk-java#2581) i have a problem to upload files if exactly 1 byte is missing in the last slice. The upload is throwing...
Open Graph Description: Describe the bug Hello, (this is a duplicate post. I think i opened it in the wrong repository. microsoftgraph/msgraph-sdk-java#2581) i have a problem to upload files if exactly 1 byte is missing i...
X Description: Describe the bug Hello, (this is a duplicate post. I think i opened it in the wrong repository. microsoftgraph/msgraph-sdk-java#2581) i have a problem to upload files if exactly 1 byte is missing i...
Opengraph URL: https://github.com/microsoftgraph/msgraph-sdk-java-core/issues/2140
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"LargeFileUpload problem if 1 byte left from last slice","articleBody":"### Describe the bug\n\nHello,\n(this is a duplicate post. I think i opened it in the wrong repository. https://github.com/microsoftgraph/msgraph-sdk-java/issues/2581)\n\ni have a problem to upload files if exactly 1 byte is missing in the last slice.\n\nThe upload is throwing an exception:\njava.util.concurrent.CancellationException: The upload task was retried the maximum number of times without success and has been cancelled.\n\nE.g.\nFilesize: 288001\n\nSlice: 32000\nUploaded 32000 bytes of 288001 total bytes\nUploaded 64000 bytes of 288001 total bytes\nUploaded 96000 bytes of 288001 total bytes\nUploaded 128000 bytes of 288001 total bytes\nUploaded 160000 bytes of 288001 total bytes\nUploaded 192000 bytes of 288001 total bytes\nUploaded 224000 bytes of 288001 total bytes\nUploaded 256000 bytes of 288001 total bytes\nUploaded 288000 bytes of 288001 total bytes\n-> last one missing\n\nSlice: 16000\nUploaded 16000 bytes of 288001 total bytes\nUploaded 32000 bytes of 288001 total bytes\nUploaded 48000 bytes of 288001 total bytes\nUploaded 64000 bytes of 288001 total bytes\nUploaded 80000 bytes of 288001 total bytes\nUploaded 96000 bytes of 288001 total bytes\nUploaded 112000 bytes of 288001 total bytes\nUploaded 128000 bytes of 288001 total bytes\nUploaded 144000 bytes of 288001 total bytes\nUploaded 160000 bytes of 288001 total bytes\nUploaded 176000 bytes of 288001 total bytes\nUploaded 192000 bytes of 288001 total bytes\nUploaded 208000 bytes of 288001 total bytes\nUploaded 224000 bytes of 288001 total bytes\nUploaded 240000 bytes of 288001 total bytes\nUploaded 256000 bytes of 288001 total bytes\nUploaded 272000 bytes of 288001 total bytes\nUploaded 288000 bytes of 288001 total bytes\n-> last one missing\n\nSlice: 64000\nUploaded 64000 bytes of 288001 total bytes\nUploaded 128000 bytes of 288001 total bytes\nUploaded 192000 bytes of 288001 total bytes\nUploaded 256000 bytes of 288001 total bytes\nUploaded 288001 bytes of 288001 total bytes\n-> Ok\n\nI created a testfile with filesize 256001\n\nUploaded 64000 bytes of 256001 total bytes\nUploaded 128000 bytes of 256001 total bytes\nUploaded 192000 bytes of 256001 total bytes\nUploaded 256000 bytes of 256001 total bytes\n-> last one missing\n\nSlice: 96000\nUploaded 96000 bytes of 256001 total bytes\nUploaded 192000 bytes of 256001 total bytes\nUploaded 256001 bytes of 256001 total bytes\n-> Ok\n\n```\nCreateUploadSessionPostRequestBody uploadSessionRequest = new CreateUploadSessionPostRequestBody();\n\nDriveItemUploadableProperties properties = new DriveItemUploadableProperties();\n\nproperties.getAdditionalData().put(\"@microsoft.graph.conflictBehavior\", \"replace\");\n\nuploadSessionRequest.setItem(properties);\n\nUploadSession uploadSession = graphClient\n .drives()\n .byDriveId(driveId)\n .items()\n .byDriveItemId(pfad)\n .createUploadSession()\n .post(uploadSessionRequest);\n\n// Create the upload task\n\nint maxSliceSize = 320 * 100;\n\nLargeFileUploadTask\u003cDriveItem> largeFileUploadTask = new LargeFileUploadTask\u003c>(\n graphClient.getRequestAdapter(),\n uploadSession,\n fileStream,\n streamSize,\n maxSliceSize,\n DriveItem::createFromDiscriminatorValue);\n\nint maxAttempts = 5;\n\n// Create a callback used by the upload provider\nIProgressCallback callback = (current, max) -> System.out.println(\n String.format(\"Uploaded %d bytes of %d total bytes\", current, max));\n\n // Do the upload\nUploadResult\u003cDriveItem> uploadResult = largeFileUploadTask.upload(maxAttempts, callback);\nif (uploadResult.isUploadSuccessful()) {\n logger.info(\"Upload complete\");\n logger.info(\"Item ID: {}\",uploadResult.itemResponse.getId());\n} else {\n logger.info(\"Upload failed\");\n}\n```\n\n### Expected behavior\n\nUpload complete file\n\n### How to reproduce\n\nCreate a file with filesize = x * maxSliceSize +1\n\n### SDK Version\n\n6.65.0\n\n### Latest version known to work for scenario above?\n\n_No response_\n\n### Known Workarounds\n\n_No response_\n\n### Debug output\n\n\u003cdetails>\u003csummary>Click to expand log\u003c/summary>\n\n```\nError Message:\nCaused by: java.util.concurrent.CancellationException: The upload task was retried the maximum number of times without success and has been cancelled.\nat com.microsoft.graph.core.tasks.LargeFileUploadTask.upload(LargeFileUploadTask.java:149)\n```\n\n\u003c/details>\n\n\n### Configuration\n\nLinux\nJava 8\nx64\n\n### Other information\n\nAccording to AI (not tested):\n\nwhile(currentRangeBegin \u003c currentEnd)\n\nshould be\n\nwhile(currentRangeBegin \u003c= currentEnd)","author":{"url":"https://github.com/assachs","@type":"Person","name":"assachs"},"datePublished":"2026-10-26T20:45:05Z","url":"https://github.com/microsoftgraph/msgraph-sdk-java-core/issues/2140"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3d9e9dd2-bcae-5ca7-2111-cc4ca8692873 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DEF0:3BC4C7:A07378:E9A11D:6AF6F534 |
| html-safe-nonce | 2b5672cdc36d9aa1d12974b9dc9fc6dfb810ba86d9422f1cf631a601e2de0c54 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJERUYwOjNCQzRDNzpBMDczNzg6RTlBMTFEOjZBRjZGNTM0IiwidmlzaXRvcl9pZCI6IjQyMTA3NzY5MzIyNDY1NDk4MTIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5b21faa64d8a5ad736bcc13ac061211b2809ec4913fd140791d719db5922b67d |
| hovercard-subject-tag | issue:6047845192 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoftgraph/msgraph-sdk-java-core/2140/issue_layout |
| twitter:image | https://opengraph.githubassets.com/15d376975b600a9ce880fc61ed816b8a40b5ac7be4d3b52348f7af1e152951c1/microsoftgraph/msgraph-sdk-java-core/issues/2140 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/15d376975b600a9ce880fc61ed816b8a40b5ac7be4d3b52348f7af1e152951c1/microsoftgraph/msgraph-sdk-java-core/issues/2140 |
| og:image:alt | Describe the bug Hello, (this is a duplicate post. I think i opened it in the wrong repository. microsoftgraph/msgraph-sdk-java#2581) i have a problem to upload files if exactly 1 byte is missing i... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | assachs |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2ae15374a87428953d7096371e998eca7fd2765a5ba8900591dfe166e04846c2 |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoftgraph/msgraph-sdk-java-core git https://github.com/microsoftgraph/msgraph-sdk-java-core.git |
| octolytics-dimension-user_id | 17304259 |
| octolytics-dimension-user_login | microsoftgraph |
| octolytics-dimension-repository_id | 154607328 |
| octolytics-dimension-repository_nwo | microsoftgraph/msgraph-sdk-java-core |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 154607328 |
| octolytics-dimension-repository_network_root_nwo | microsoftgraph/msgraph-sdk-java-core |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 75a77d308b852e88dc17e912795a3e67749c0ebc |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width