Some archive by year page return 404

Did you check to make sure the folder structure is correct in your WordPress installation? A 404 error is caused if the URL does not point to a valid area. So if the URL is yourwebsite/2019/04/myblogname – and a 404 error appears – it means there is no file with that name.

A few ways to approach this.

Something is wrong with your permalink structure. In Setting -> Permalink. Enter in there and just click ‘save’ to refresh your permalink structure.

Also, while you are here…what is your permalink structure look like? Did you change it? Perhaps those posts are no longer at the example (/2019/04/myblogpost). Check out the setting for permalink here: https://wordpress.org/support/article/settings-permalinks-screen/

I would say, that the links on your archive are inaccurate. Try finding out where a 2019 blog post is located at. If you changed the permalink structure and the option you picked is /yourwebsite/myblogpost, that means /blog/2019/04/myblogpost no longer exists and you will get a 404 error.

I believe your issue is related to the permalink settings you choose. If it looks right, reset the settings (by just saving and WordPress will rebuild it).

So, 1. Your links in the archive are pointing to old file locations or 2. Your permalink settings are off (or need to be reset).

One of these will most likely be your issue.