You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "amoghrajesh (via GitHub)" <gi...@apache.org> on 2025/08/07 13:29:24 UTC

[I] Display a more user friendly error when invalid branches are provided to branch operators [airflow]

amoghrajesh opened a new issue, #54224:
URL: https://github.com/apache/airflow/issues/54224

   ### Body
   
   Right now, if a branch operator doesnt have a clear branch to take, it displays:
   
   ```
   ERROR - Task failed with exception
   AirflowException: 'branch_task_ids' expected all task IDs are strings. Invalid tasks found: {(None, 'NoneType')}.
   File "/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py", line 918 in run
   
   File "/opt/airflow/task-sdk/src/airflow/sdk/execution_time/task_runner.py", line 1205 in _execute_task
   
   File "/opt/airflow/task-sdk/src/airflow/sdk/bases/operator.py", line 403 in wrapper
   
   File "/opt/airflow/providers/standard/src/airflow/providers/standard/operators/branch.py", line 102 in execute
   
   File "/opt/airflow/providers/standard/src/airflow/providers/standard/operators/branch.py", line 44 in do_branch
   
   File "/opt/airflow/providers/standard/src/airflow/providers/standard/utils/skipmixin.py", line 137 in skip_all_except
   ```
   
   This can be better formatted / presented to the end users.
   
   To repro, run this:
   ```
   from datetime import timedelta
   
   from airflow.sdk import DAG
   from airflow.providers.standard.operators.empty import EmptyOperator
   from airflow.providers.standard.operators.python import BranchPythonOperator, PythonOperator
   
   default_args = {
       "owner": "airflow",
       "depends_on_past": False,
       "retries": 1,
       "retry_delay": timedelta(minutes=5),
   }
   
   
   def predestine(**kwargs):
       kwargs["ti"].xcom_push(key="choice", value="foo")
   
   
   def let_fates_decide(**kwargs):
       return kwargs["ti"].xcom_pull(key="choice")
   
   
   with DAG(
       dag_id="simple_branch",
       schedule=None,
       default_args=default_args,
       catchup=False,
       tags=["core"],
   ) as dag:
       (
           PythonOperator(task_id="predestine", python_callable=predestine)
           >> BranchPythonOperator(
               task_id="let_fates_decide",
               python_callable=let_fates_decide,
           )
           >> [EmptyOperator(task_id="foo"), EmptyOperator(task_id="bar")]
       )
   
   ```
   
   ### Committer
   
   - [x] I acknowledge that I am a maintainer/committer of the Apache Airflow project.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Display a more user friendly error when invalid branches are provided to branch operators [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on issue #54224:
URL: https://github.com/apache/airflow/issues/54224#issuecomment-3164553758

   Happy to grab this one :)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Display a more user friendly error when invalid branches are provided to branch operators [airflow]

Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh closed issue #54224: Display a more user friendly error when invalid branches are provided to branch operators
URL: https://github.com/apache/airflow/issues/54224


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Display a more user friendly error when invalid branches are provided to branch operators [airflow]

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on issue #54224:
URL: https://github.com/apache/airflow/issues/54224#issuecomment-3173841972

   cc @jroachgolf84 we may want to support the None functionality after all. see https://github.com/apache/airflow/issues/54340


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Display a more user friendly error when invalid branches are provided to branch operators [airflow]

Posted by "amoghrajesh (via GitHub)" <gi...@apache.org>.
amoghrajesh commented on issue #54224:
URL: https://github.com/apache/airflow/issues/54224#issuecomment-3164618798

   Go for it, @jroachgolf84!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Display a more user friendly error when invalid branches are provided to branch operators [airflow]

Posted by "jroachgolf84 (via GitHub)" <gi...@apache.org>.
jroachgolf84 commented on issue #54224:
URL: https://github.com/apache/airflow/issues/54224#issuecomment-3168858202

   > would like to work on this issue
   
   @DevaP06, I've already created a PR for this. There are a bunch of other open issues tho!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Display a more user friendly error when invalid branches are provided to branch operators [airflow]

Posted by "DevaP06 (via GitHub)" <gi...@apache.org>.
DevaP06 commented on issue #54224:
URL: https://github.com/apache/airflow/issues/54224#issuecomment-3168836439

   would like to work on this issue


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org