There is a specific export setting for Youtube in the long list of export presets. Export errors like this are usually not reliably reproducible, however here is a similar post where I wrote about possible errors that might come up when exporting, and that helped someone.