Airflow parses every Dag file again and again to notice changes. If running the file raises an exception, the file gets an import error: its Dags disappear from the list, while Dags from other files carry on. The Dags page shows a red banner, and airflow dags list-import-errors prints the traceback.
The usual causes are a typo in an import (from airflow.sdk import Dag instead of DAG), an argument Airflow 3 no longer accepts (schedule_interval), a duplicate task id (often from a loop that reuses one id), an invalid id, or a cycle.
Parsing runs all top-level code: everything outside task functions. Keep it fast and free of side effects. A database query or an API call at the top of the file runs every time the file is parsed, slows the Dag processor down, and turns an outage of that system into an import error. Put that work inside a task, where it runs once per run.
A loop created two tasks with the same id. Build the id from the loop variable.