Microsoft Graph API Bug: Graph API creates _api/v2.0.0 when uploading v1.0.0 — HTTP 201 with incorrect DriveItem name and parentReference

abraunegg 0 Reputation points
2026-10-27T06:28:54.0366667+00:00

Category

  • [ ] Question
  • [ ] Documentation issue
  • [x] Bug

Summary

A valid Microsoft Graph path-based upload request for a new file named v1.0.0 in OneDrive Personal returns HTTP 201 Created, but creates a different remote item:

  • Requested: issue3930-test/fresh/v1.0.0
  • Actually created: issue3930-test/fresh/_api/v2.0.0

The unexpected item has the uploaded content (five bytes, with matching reported content hashes), but the returned DriveItem has the wrong name and parentReference. The service also creates an unrequested _api directory.

This has been independently reproduced on two different Linux systems and OneDrive Personal accounts in different Microsoft data centres. It is not specific to Git repositories or the Linux client's SQLite database.

Original report and technical investigation: https://github.com/abraunegg/onedrive/issues/3930

Expected behaviour

The documented small-file upload operation:


PUT https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{parent-id}:/v1.0.0:/content

Authorization: Bearer {access-token}

Content-Type: application/octet-stream

<five-byte payload: "test\n">

should create a file called v1.0.0 directly inside the folder with ID {parent-id}. The returned DriveItem should identify that filename and parent:


{

  "name": "v1.0.0",

  "size": 5,

  "parentReference": {

    "driveId": "{drive-id}",

    "id": "{parent-id}"

  }

}

The API should not create additional subdirectories or silently change the requested item identity. If it cannot satisfy the request, it should return an appropriate error rather than a success response describing a different destination.

Actual behaviour

The service returns HTTP/2 201 Created for the v1.0.0 upload, but its response describes a file named v2.0.0 inside a newly created folder named _api:


issue3930-test/

└── fresh/

    ├── v0.4.1           # control upload: correct

    └── _api/            # never requested

        └── v2.0.0       # contains the bytes sent for v1.0.0

There is no fresh/v1.0.0 at the requested destination. A sibling control file, v0.4.1, uploaded through the same code path and account, is created correctly.

The affected file's contents and reported hash match the source. Consequently, a client that validates upload size and hash alone can regard the operation as successful even though the server stored the file at the wrong path.

Representative returned DriveItem fields

The independent maintainer reproduction returned an item equivalent to:


{

  "name": "v2.0.0",

  "size": 5,

  "parentReference": {

    "driveType": "personal",

    "driveId": "{drive-id}",

    "id": "{unexpected-api-folder-id}",

    "name": "_api",

    "path": "/drives/{drive-id}/root:/issue3930-test/fresh/_api"

  }

}

The placeholders above intentionally redact account-specific object IDs. This is a representative excerpt, not a verbatim full HTTP response.

Minimal reproduction

  1. Use a Microsoft OneDrive Personal account and obtain a Graph access token with appropriate write permissions.
  2. Create an isolated folder issue3930-test/fresh and record its DriveItem ID ({parent-id}).
  3. Create two ordinary five-byte local files:
    
       printf 'test\n' > v0.4.1
    
       printf 'test\n' > v1.0.0
    
    
  4. Upload the control file to the existing parent:
    
       PUT https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{parent-id}:/v0.4.1:/content
    
       Authorization: Bearer {access-token}
    
       Content-Type: application/octet-stream
    
       <contents of v0.4.1>
    
    
    Observe that it is created as fresh/v0.4.1.
  5. Upload the affected file:
    
       PUT https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{parent-id}:/v1.0.0:/content
    
       Authorization: Bearer {access-token}
    
       Content-Type: application/octet-stream
    
       <contents of v1.0.0>
    
    
  6. Observe HTTP 201 Created, inspect the returned DriveItem name, parentReference, and size, and enumerate the remote folder. The operation has created _api/v2.0.0 rather than the requested v1.0.0.

Important qualification: These steps reproduce the confirmed behaviour through the OneDrive Client for Linux, which issues the documented Graph request. An independent, standalone HTTP-client test is still useful to isolate any transport-layer involvement.

Independent reproduction environments

| Property | Original reporter | Independent maintainer reproduction |

|---|---|---|

| Date | 25–26 October 2026 | 26 October 2026 |

| Operating system | CachyOS | Fedora 40 |

| OneDrive account | Personal | Personal |

| OneDrive Client for Linux | v2.5.12 | v2.5.12 |

| D compiler | LDC 2.113 | DMD 2.103 |

| libcurl | 8.23.0 | 8.6.0 |

| Microsoft data centre | Germany West Central | Australia Southeast |

| Requested name | v1.0.0 | v1.0.0 |

| Returned name/path | _api/v2.0.0 | _api/v2.0.0 |

| Control file v0.4.1 | Succeeded normally | Succeeded normally |

The independent reproduction used plain five-byte files, not a Git repository, rsync, or any other local synchronisation tool. Different distributions, compilers, libcurl versions, and Microsoft data centres produce the same highly specific transformation.

We have not yet established whether OneDrive for Business or SharePoint Online are affected.

Microsoft service request correlation — independent reproduction

The following values were captured in the Fedora 40 reproduction and can be used to investigate server-side telemetry:

  • UTC date/time: 2026-10-26 03:41:03 UTC (approximately)
  • Operation: PUT https://graph.microsoft.com/v1.0/drives/{drive-id}/items/{parent-id}:/v1.0.0:/content
  • HTTP response: 201 Created over HTTP/2
  • Graph request-id: 6292c9ee-860d-460c-8f37-fc4d67644435
  • Graph client-request-id: 6292c9ee-860d-460c-8f37-fc4d67644435
  • splogid: 8f8748a2-60be-0001-02ae-852b4d62a95f
  • Microsoft data centre: Australia Southeast
  • Server diagnostic: Slice E, Ring 3, ScaleUnit 001

A later response in the same reproduction carried request ID 3635e9fe-ec08-48aa-abed-7e88d5317fec and described the unexpected v2.0.0 DriveItem. Full sanitised transaction logs can be made available if needed.

No intermediate HTTP 3xx response was recorded for the failing upload. We do not know which internal Microsoft component performed the path translation.

The original reporter also captured a path-based GET for a requested v1.0.0 item that returned metadata for the unexpected _api/v2.0.0 item. This caused the application to treat the wrong remote object as a match for the local file.

Thus, the issue may affect both creation and resolution of path-addressed DriveItems. The upload behaviour has been independently reproduced; the lookup behaviour is currently supported by the original reporter's logs.

Why this does not appear to be a client-side filename change

The relevant Linux client upload implementation builds the documented path-based URL as follows:


string url = driveByIdUrl ~ parentDriveId

    ~ "/items/" ~ parentId ~ ":/"

    ~ encodeComponent(filename) ~ ":/content";

For the filename v1.0.0, the outgoing request URL logged by the client contains the requested literal filename. There is no client-side rename to v2.0.0 and no client-generated _api folder.

This URL construction is unchanged between the Linux client's v2.5.11 and v2.5.12 release tags. The problem therefore is not identified as a v2.5.12 application regression.

We cannot yet prove the internal Graph/OneDrive service root cause; the reproducible contract violation is that the successful API response represents a different destination from the request.

Downstream consequences for sync and backup software

  1. Incorrect destination despite HTTP success: A valid operation returns 201 and matching contents but the wrong remote path.
  2. Repeated upload attempts: The intended v1.0.0 remains absent, so clients may retry on subsequent scans.
  3. Unexpected folder creation: _api appears without being requested.
  4. Incorrect path lookup: The original reporter observed a GET for the intended path resolving to the unexpected item.
  5. Local reconciliation errors: The Linux client attempts to save the returned item under the unknown _api parent and SQLite correctly reports FOREIGN KEY constraint failed.
  6. Potential automated backup impact: The original case involved a Git repository backup, where version tag filenames such as v1.0.0 are ordinary data.

The SQLite foreign-key error is a consequence, not the cause, of the incorrect remote DriveItem identity.

Hypothesis: versioned API route collision

The exact transformation is suspicious:


v1.0.0  →  _api/v2.0.0

The public Microsoft Graph API uses /v1.0/, while OneDrive services also use internal API routes containing /_api/v2.0/. One possibility is that a route-translation or path-normalisation stage confuses the filename prefix v1.0 with a versioned API path component.

This is only a hypothesis. The logs do not establish which Microsoft component, if any, performs this transformation. We ask Microsoft to use the correlation IDs above to determine the actual cause.

We searched both open and closed issues in this repository and did not find an existing report of this exact v1.0.0 → _api/v2.0.0 transformation. Related precedents include:

These are not exact duplicates, but they demonstrate a history of filename-sensitive path-handling issues.

Questions for Microsoft engineering

  1. Why does a valid path-based PUT for v1.0.0 return HTTP 201 while creating _api/v2.0.0 under a different parent?
  2. Is there a routing/path-normalisation collision between the filename prefix v1.0 and internal API version routes?
  3. Can the supplied request-id and splogid identify where the incorrect name and parent are introduced?
  4. Why is a successful response returned when the requested resource identity is not preserved?
  5. Does the same issue affect path-based GET lookups and createUploadSession operations?
  6. Which other version-like filenames, if any, are affected?
  7. Is the issue confined to OneDrive Personal, or can it affect Business/SharePoint?
  8. Is there a supported workaround preserving the exact requested filename and parent, and is a service-side correction planned?

Our preference is for a service-side correction, rather than implementing filename-specific transformations in client applications for otherwise valid Graph API requests.

References

We can provide additional sanitised HTTP diagnostics and repeat targeted tests against our Personal account to assist the investigation. Please advise what additional information would be most useful.

Reference: https://github.com/OneDrive/onedrive-api-docs/issues/1934

Microsoft 365 and Office | OneDrive | Other | MacOS
0 comments No comments

1 answer

Sort by: Newest
  1. Rukshan edirisinghe 2,365 Reputation points
    2026-10-31T02:14:32.8666667+00:00

    Hi @abraunegg

    Thanks for the very clear repro. The pattern you found (a name like v1.0.0 in the path coming out as _api/v2.0.0) looks like the OneDrive Personal backend treats a path segment that looks like an API version (v1.0) as part of its own routing, instead of as a file name. That's a service-side bug, so only Microsoft can fix it. Until they do, a client can avoid sending the name in the URL path at all:

    1. Upload under a safe temporary name, for example PUT /drives/{drive-id}/items/{parent-id}:/upload.tmp:/content.
    2. Rename it with a body-based update: PATCH /drives/{drive-id}/items/{new-item-id} with { "name": "v1.0.0" }. The name then travels in the JSON body, not in the URL, so the path rewriting shouldn't apply.
    3. Check the result: GET the item and confirm the name and parentReference.id before you treat the upload as done.
    4. Clean up any _api folders left by earlier attempts. Make sure nothing else was written into them before you delete them.

    Please test step 2 on a throwaway folder first. I haven't seen Microsoft document this behaviour, so I can't promise the rename path is unaffected, but it's the obvious way to keep the name out of the URL.

    To get it in front of the product team, open an issue on the OneDrive API docs GitHub repository (OneDrive/onedrive-api-docs), which is where OneDrive API bugs are tracked, and link your issue #3930 there. Include the request IDs and timestamps from the response headers (request-id and Date), but leave out tokens and account details.

    Does the rename via PATCH keep the v1.0.0 name in your test?

    If the workaround holds, please consider accepting it as the answer. If the rename gets rewritten too, let me know and I'll be happy to keep helping.

    Reference:

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.