Skip to content

XComObjectStorageBackend in Airflow 3.0.1 Returns File Paths Instead of Deserialized Objects in Mapped Tasks #50636

@GeryDeKocliko

Description

@GeryDeKocliko

Apache Airflow version

3.0.1

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

No response

What happened?

Hi,

After upgrading to Airflow 3.0.1, I observed that certain XCom values are no longer returned as deserialized Python objects. Instead, they are returned as file paths. This behavior differs from 3.0.0 versions, where XComs were automatically deserialized upon retrieval.

What you think should happen instead?

XComs should consistently return deserialized Python objects upon retrieval, maintaining the behavior observed in previous Airflow versions.

How to reproduce

Xcom Environment Configuration :

    AIRFLOW__CORE__XCOM_BACKEND: airflow.providers.common.io.xcom.backend.XComObjectStorageBackend
    AIRFLOW__COMMON_IO__XCOM_OBJECTSTORAGE_PATH: file://airflow/xcoms
    AIRFLOW__COMMON_IO__XCOM_OBJECTSTORAGE_THRESHOLD: 0

DAG :

from airflow.decorators import dag, task
from airflow.models.xcom import XCom

@task
def generate_data():
    print("XCom.__name__ --->", XCom.__name__)
    return [1, 2, 3]


@task
def filter_item_from_mapped_task(item):
    print("filter_item_from_mapped_task item --->", item)
    if item==1:
        return None
    return item


@task
def print_item(item):
    print("print_item item --->", item)


@dag(
    dag_id='test_bug_dag',
)
def test_bug_dag():
    data = generate_data()
    filtered_data = filter_item_from_mapped_task.expand(item=data)
    print_item.expand(item=filtered_data)

test_bug_dag()

Steps to Reproduce:
1. Deploy the above DAG in your Airflow environment configured with the specified XCom backend settings.
2. Trigger the DAG manually.
3. Observe the logs for each task execution.

Observed Behavior:
• Between generate_data and filter_item_from_mapped_task: The XCom value is deserialized as expected, and the item parameter receives the actual data (e.g., integers).
• Between filter_item_from_mapped_task and print_item: The item parameter receives a file URI instead of the deserialized object. For example: print_item item ---> file:///opt/airflow/airflow/xcoms/test_bug_dag/manual__2025-05-15T06:15:18.397306+00:00/filter_item_from_mapped_task/a1f9943d-b61b-4cae-9b25-527190b96567

Operating System

Mac OS 14.6

Versions of Apache Airflow Providers

apache-airflow-providers-common-io==1.5.4

Deployment

Docker-Compose

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions