> ## Documentation Index
> Fetch the complete documentation index at: https://docs.yampi.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Erros

O Editor de Código inclui um validador que identifica problemas em arquivos Twig, Vue e SCSS — como tags mal fechadas ou sintaxe inválida — diretamente na interface, indicando a linha exata do erro.

***

## Como o validador funciona

* As mensagens de erro aparecem diretamente na interface do editor ao salvar o arquivo.
* Cada mensagem indica o arquivo e a linha onde o problema foi detectado.

***

## Exemplo de erro

Considere o trecho a seguir, com uma tag `if` sem fechamento dentro de um `for`:

```twig theme={"system"}
{% for section in sections %}
    {% if section.visible %}
        {% include 'sections/' ~ section.section_alias ~ '.twig' with section %}
{% endfor %}
```

O validador exibe a seguinte mensagem:

```plaintext theme={"system"}
Erro de sintaxe na linha 14 do arquivo:
Unexpected "endfor" tag (expecting closing tag for the "if" tag defined near line 13).
```

***

## Corrigindo o erro

<Steps>
  <Step title="Localizar a linha indicada">
    Abra o arquivo apontado pelo validador e vá até a linha indicada na mensagem.
  </Step>

  <Step title="Revisar a estrutura do código">
    Verifique se todas as tags abertas (`{% if %}`, `{% for %}`, `{% block %}`) têm o fechamento correspondente (`{% endif %}`, `{% endfor %}`, `{% endblock %}`).
  </Step>

  <Step title="Aplicar a correção">
    Ajuste o código para fechar corretamente as tags:

    ```twig theme={"system"}
    {% for section in sections %}
        {% if section.visible %}
            {% include 'sections/' ~ section.section_alias ~ '.twig' with section %}
        {% endif %}
    {% endfor %}
    ```
  </Step>

  <Step title="Salvar e verificar">
    Salve o arquivo (`Ctrl + S` / `Cmd + S`) e confirme que a mensagem de erro desapareceu.
  </Step>
</Steps>
