As discussed in the comments, it's getting confused by the nested single quotes. HTML-encoding the outer pair allows it to work, although VS Code still shows an error.
<header class="masthead" style="background-image: url('{{ url_for('static', filename='assets/img/home-bg.jpg') }}')">