SharePoint - The URL is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.


⛔️ PROBLEM

User receives error message 'URL is invalid' while uploading file to SharePoint Online or SharePoint 2013 document library.
The problem is not limited to any specific file format, it may occur with docx, xlsx, pdf, other.

The URL [file name] is invalid. It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.

SharePoint file upload URL is invalid
SharePoint file upload URL is invalid

✔️ How to fix URL is invalid SharePoint error

Version Column The problem may occur when the Version column is configured as an Indexed Column. Remove the Version column from the list of Indexed Columns to fix.
  1. Navigate to the library/list with problem.
  2. From Ribbon --> Library tab --> Library Settings.
  3. Click Fields --> Indexed Columns.
  4. Click Indexed Columns --> Version.
  5. Click Delete --> click OK.
  6. Re-upload the problematic file again.

Invalid Date The problem may occur when the default value for date column is incorrect, maybe an invalid format. Make sure the value for date/time filed is in the expected format.

Make necessary changes and re-try, the file should be uploaded now.

Characters exceeding The problem may occur when the file name exceeds the maximum character limit. SharePoint document's URL can be upto 400 characters long. Avoid long path names.

Copy file contents The problem may be sometimes with the file itself and not the contents. Copy the contents to a new file and try uploading, this works in many cases.

More help with ULS logs If you still can't figure out the problem, check SharePoint logs (C:\Program files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS) or ask Microsoft support to provide you the logs, deep dive into the logs to find the issue and fix. Contact Microsoft Support for further help.