Twig adds an unwanted 'row' class that doesn't appear in class array My site theme includes customised templates for 4 regions in the footer, all containing identical code:
  set classes = [
    'region',
    'region-' ~ region|clean_class,
    'col-sm-12',
    'col-md-6',
    'col-lg-3',
  ]
%}
{% if content %}
  &lt;section{{ attributes.addClass(classes) }}&gt;
    {{ content }}
  &lt;/section&gt;
{% endif %}

However, the HTML it produces varies.
In the first two regions, the class row is being inserted - despite it not appearing in the classes array:
&lt;!-- BEGIN OUTPUT from 'themes/custom/my_theme/templates/layout/region--footer-first.html.twig' --&gt;
  &lt;section class=&quot;row region region-footer-first col-sm-12 col-md-6 col-lg-3&quot;&gt;

In the last 2 regions, the row class is missing - which is the correct code I want:
&lt;!-- BEGIN OUTPUT from 'themes/custom/my_theme/templates/layout/region--footer-third.html.twig' --&gt;
  &lt;section class=&quot;region region-footer-first col-sm-12 col-md-6 col-lg-3&quot;&gt;

I can't figure out where it's coming from, so my workaround is to include an additional step that removes the class, in the first two region templates only:
&lt;section{{ attributes.addClass(classes).removeClass('row') }}&gt;

This gives the result I want, but I'm still not sure where the row class comes from and why it was being applied inconsistently??
Those 5 classes are being added using .addClass() to a pre-existing {{ attributes }} Twig object. The 'row' class must already be in the attributes object when Drupal passes it to the Twig template.
Typically, the place where something like that would happen is in your .theme file (or the parent theme's .theme file if yours is a subtheme). Look for a function like THEMENAME_preprocess_region() and see if you can find a hard-coded &quot;row&quot; string being thrown in there.
Alternatively, some fancier theme systems might expose configuration options in the Drupal interface that could be setting that class. You'd find those under Admin &gt; Appearance, then in &quot;Settings&quot; for your active theme.