Airflow stores XCom data in its metadata database. Large XComs can cause the database to grow quickly, which slows down the scheduler and affects performance.
task_instance.xcom_push(key='large_data', value='x' * 5000000) # 5MB string
When an XCom value exceeds the size limit, Airflow raises an AirflowException to prevent storing too large data.
Storing large data externally and passing only a reference in XCom keeps the metadata database small and avoids size limits.
The error occurs because the task tries to push too large data. Changing the task to store data externally and push a reference fixes the root cause.
Uploading large files to external storage and passing only the path via XCom is the recommended approach to handle large data efficiently.
