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

   ### Apache Airflow version
   
   3.1.5
   
   ### If "Other Airflow 3 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   While testing providers release on 2025-12-30 I noticed that when attempting 
to create a User in Fab and I miss to set the "Role" field I get a Ooops / HTTP 
500 screen:
   
   <img width="1152" height="1271" alt="Image" 
src="https://github.com/user-attachments/assets/0546ad5b-d3ab-4223-b5c3-9195cf273fbe";
 />
   (see Role field is empty)
   
   <img width="1170" height="472" alt="Image" 
src="https://github.com/user-attachments/assets/cdc5447c-a8c8-4a49-b37d-baebc8d0d481";
 />
   
   If a Role is selected it is working.
   
   Stack trace from API Server:
   ```
   2025-12-31T11:17:07.982595Z [error    ] Exception on /users/add [POST] 
[airflow.providers.fab.www.app] loc=app.py:1744
   Traceback (most recent call last):
     File "/usr/python/lib/python3.12/site-packages/flask/app.py", line 2529, 
in wsgi_app
       response = self.full_dispatch_request()
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/site-packages/flask/app.py", line 1825, 
in full_dispatch_request
       rv = self.handle_user_exception(e)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/site-packages/flask/app.py", line 1823, 
in full_dispatch_request
       rv = self.dispatch_request()
            ^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/site-packages/flask/app.py", line 1799, 
in dispatch_request
       return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File 
"/usr/python/lib/python3.12/site-packages/flask_appbuilder/security/decorators.py",
 line 151, in wraps
       return f(self, *args, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/site-packages/flask_appbuilder/views.py", 
line 237, in add
       widget = self._add()
                ^^^^^^^^^^^
     File 
"/usr/python/lib/python3.12/site-packages/flask_appbuilder/baseviews.py", line 
1241, in _add
       if form.validate():
          ^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/site-packages/wtforms/form.py", line 330, 
in validate
       return super().validate(extra)
              ^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/site-packages/wtforms/form.py", line 147, 
in validate
       if not field.validate(self, extra):
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/site-packages/wtforms/fields/core.py", 
line 234, in validate
       stop_validation = self._run_validation_chain(form, chain)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/python/lib/python3.12/site-packages/wtforms/fields/core.py", 
line 254, in _run_validation_chain
       validator(form, self)
     File 
"/usr/python/lib/python3.12/site-packages/flask_appbuilder/security/forms.py", 
line 25, in roles_or_groups_required
       if not form["roles"].data and not form["groups"].data:
                                         ~~~~^^^^^^^^^^
     File "/usr/python/lib/python3.12/site-packages/wtforms/form.py", line 64, 
in __getitem__
       return self._fields[name]
              ~~~~~~~~~~~~^^^^^^
   KeyError: 'groups'
   ```
   
   ### What you think should happen instead?
   
   Same like in Fab as released with Airflow 3.1.5 there should be a validation 
error generated, not a HTTP 500:
   
   <img width="784" height="156" alt="Image" 
src="https://github.com/user-attachments/assets/d48ec8c6-966e-4ad0-8d75-09db24854317";
 />
   
   ### How to reproduce
   
   Use Fab apache-airflow-providers-fab==3.1.1rc1 or start on latest main via 
`breeze start-airflow --python 3.12 --load-example-dags --backend postgres 
--executor LocalExecutor --answer y --auth-manager FabAuthManager`
   
   Log in as admin and go to Security->Users, add a user and miss-out to fill 
the "Roles" field.
   
   ### Operating System
   
   Linux
   
   ### Versions of Apache Airflow Providers
   
   Fab 3.1.1rc1 or latest main
   
   ### Deployment
   
   Other
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to