[#6150] Fix issues with auto_publish when encountering invalid data