GitHub user joshhoughton created a discussion: `AttributeError: module 
'flask.json' has no attribute 'JSONEncoder'`

### Apache Airflow version

3.0.4

### If "Other Airflow 2 version" selected, which one?

_No response_

### What happened?

After updating to 3.0.4 (from 3.0.3), I'm getting a `AttributeError: module 
'flask.json' has no attribute 'JSONEncoder'` error.

```log
[2025-08-11T12:40:03.040Z] {"asctime": "2025-08-11 12:40:02,388", "name": 
"airflow.cli.cli_parser", "levelname": "WARNING", "message": "cannot load CLI 
commands from auth manager: module 'flask.json' has no attribute 
'JSONEncoder'", "filename": "cli_parser.py", "lineno": 81, "level": "WARNING"}
[2025-08-11T12:40:03.040Z] {"asctime": "2025-08-11 12:40:02,389", "name": 
"airflow.cli.cli_parser", "levelname": "WARNING", "message": "Auth manager is 
not configured and api-server will not be able to start.", "filename": 
"cli_parser.py", "lineno": 82, "level": "WARNING"}
[2025-08-11T12:40:06.325Z] Traceback (most recent call last):
[2025-08-11T12:40:06.325Z]   File "/opt/initdb", line 96, in <module>
[2025-08-11T12:40:06.325Z]     initdb()
[2025-08-11T12:40:06.325Z]   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/session.py", 
line 101, in wrapper
[2025-08-11T12:40:06.325Z]     return func(*args, session=session, **kwargs)
[2025-08-11T12:40:06.325Z]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-11T12:40:06.325Z]   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/db.py", line 
748, in initdb
[2025-08-11T12:40:06.325Z]     external_db_manager = RunDBManager()
[2025-08-11T12:40:06.325Z]                           ^^^^^^^^^^^^^^
[2025-08-11T12:40:06.325Z]   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/db_manager.py",
 line 153, in __init__
[2025-08-11T12:40:06.325Z]     auth_manager_db_manager = 
create_auth_manager().get_db_manager()
[2025-08-11T12:40:06.325Z]                               ^^^^^^^^^^^^^^^^^^^^^
[2025-08-11T12:40:06.325Z]   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/app.py", 
line 138, in create_auth_manager
[2025-08-11T12:40:06.325Z]     auth_manager_cls = get_auth_manager_cls()
[2025-08-11T12:40:06.325Z]                        ^^^^^^^^^^^^^^^^^^^^^^
[2025-08-11T12:40:06.325Z]   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/api_fastapi/app.py", 
line 125, in get_auth_manager_cls
[2025-08-11T12:40:06.325Z]     auth_manager_cls = 
conf.getimport(section="core", key="auth_manager")
[2025-08-11T12:40:06.325Z]                        
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-11T12:40:06.325Z]   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/configuration.py", 
line 1239, in getimport
[2025-08-11T12:40:06.325Z]     return import_string(full_qualified_path)
[2025-08-11T12:40:06.325Z]            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-11T12:40:06.325Z]   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/utils/module_loading.py",
 line 39, in import_string
[2025-08-11T12:40:06.325Z]     module = import_module(module_path)
[2025-08-11T12:40:06.325Z]              ^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-11T12:40:06.325Z]   File 
"/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
[2025-08-11T12:40:06.325Z]     return _bootstrap._gcd_import(name[level:], 
package, level)
[2025-08-11T12:40:06.325Z]            
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2025-08-11T12:40:06.325Z]   File "<frozen importlib._bootstrap>", line 1387, 
in _gcd_import
[2025-08-11T12:40:06.325Z]   File "<frozen importlib._bootstrap>", line 1360, 
in _find_and_load
[2025-08-11T12:40:06.325Z]   File "<frozen importlib._bootstrap>", line 1331, 
in _find_and_load_unlocked
[2025-08-11T12:40:06.325Z]   File "<frozen importlib._bootstrap>", line 935, in 
_load_unlocked
[2025-08-11T12:40:06.325Z]   File "<frozen importlib._bootstrap_external>", 
line 999, in exec_module
[2025-08-11T12:40:06.325Z]   File "<frozen importlib._bootstrap>", line 488, in 
_call_with_frames_removed
[2025-08-11T12:40:06.325Z]   File 
"/home/airflow/.local/lib/python3.12/site-packages/airflow/providers/fab/auth_manager/fab_auth_manager.py",
 line 27, in <module>
[2025-08-11T12:40:06.325Z]     from connexion import FlaskApi
[2025-08-11T12:40:06.325Z]   File 
"/home/airflow/.local/lib/python3.12/site-packages/connexion/__init__.py", line 
32, in <module>
[2025-08-11T12:40:06.325Z]     from .apps.flask_app import FlaskApp
[2025-08-11T12:40:06.325Z]   File 
"/home/airflow/.local/lib/python3.12/site-packages/connexion/apps/flask_app.py",
 line 153, in <module>
[2025-08-11T12:40:06.325Z]     class FlaskJSONEncoder(json.JSONEncoder):
[2025-08-11T12:40:06.325Z]                            ^^^^^^^^^^^^^^^^
[2025-08-11T12:40:06.325Z] AttributeError: module 'flask.json' has no attribute 
'JSONEncoder'
```


### What you think should happen instead?

_No response_

### How to reproduce

Install via Pipenv with the following dependencies:

```diff
 [packages]
-apache-airflow = {extras = ["statsd", "amazon", "github_enterprise", "async", 
"cncf.kubernetes", "postgres", "standard", "common-sql", "github"], version = 
"==3.0.3"}
+apache-airflow = {extras = ["statsd", "amazon", "github_enterprise", "async", 
"cncf.kubernetes", "postgres", "standard", "common-sql", "github"], version = 
"==3.0.4"}
```

### Operating System

Debian 12

### Versions of Apache Airflow Providers

```
apache-airflow-providers-amazon==9.10.0
apache-airflow-providers-cncf-kubernetes==10.6.1
apache-airflow-providers-common-compat==1.7.3
apache-airflow-providers-common-io==1.6.2
apache-airflow-providers-common-sql==1.27.5
apache-airflow-providers-fab==2.3.0
apache-airflow-providers-github==2.9.1
apache-airflow-providers-google==15.1.0
apache-airflow-providers-http==5.3.2
apache-airflow-providers-postgres==6.2.1
apache-airflow-providers-smtp==2.2.0
apache-airflow-providers-standard==1.5.0
```

### Deployment

Other 3rd-party Helm chart

### Deployment details

Custom Dockerfiles around the official `apache/airflow:slim-3.0.4-python3.12` 
images.

### 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)


GitHub link: https://github.com/apache/airflow/discussions/54368

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to