You may receive the following error when opening a Word document from SharePoint:
We couldn't register this document. You won't be able to create links from other documents to this one.
Or you may receive the following error when opening an Excel workbook from SharePoint:
The file could not be accessed.
These two errors can happen if the file has a long file path. Per the following document, SharePoint on-premise has a 260 character limitation in the full file path, which includes the path and the file name:
https://technet.microsoft.com/en-sg/library/ff919564(v=office.14).aspx
The limitation in SharePoint Online for the file path is 400 characters:
To fix the error, reduce length of the file name so that the full file path is below the character limit.