Error can occur when upgrading SharePoint to 2013/2016. Even though the aliases are set correctly in the content DB and on the actual library the primary alias is kept in the configuration database.
Run the following command to enforce the correct aliases:
stsadm.exe -o refreshdms -url [URL]