Skip to content

Variable value formatting no longer preserved in Airflow 3.x UI #58648

@carlinix

Description

@carlinix

Apache Airflow version

3.1.3

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

No response

What happened?

Starting with Airflow 3.x, the UI no longer preserves the original formatting of variable values.

In Airflow 2.11.x and earlier, when a variable contained structured or multi-line content (e.g., JSON, YAML, or configuration text), the UI displayed the value exactly as stored — including indentation, line breaks, and whitespace. This allowed users to easily read, validate, and edit configuration content directly from the interface.

In Airflow 3.x, the same values are now shown in a compact, single-line format, ignoring all original formatting — even though the value remains correctly formatted in the metadata database. This affects readability and editing, and introduces usability issues for workflows where variables contain structured configuration.

For users storing YAML or other whitespace-sensitive formats, this behavior can also lead to unintentional task failures if the edited, minified content is saved back.

What you think should happen instead?

When viewing the list of variables, the current behavior — displaying values in a condensed single-line preview — is acceptable and useful.

Image

However, when the user clicks a variable (either through the key link or the "Edit" action), the UI should display the original stored formatting, including:

  • line breaks
  • indentation
  • whitespace

preserving the "original stored" JSON/YAML formatting.

In other words, the variable editor should present the variable exactly as it exists in the metadata database, rather than showing a minified or collapsed version.

This restores the behavior that existed in Airflow ≤ 2.11 and ensures variables containing structured data remain readable and editable within the UI.

How to reproduce

  1. Create a variable using a multi-line formatted value, for example:
airflow variables set x "$(cat << 'EOF'
{
  "key": "val",
  "key2": "val2"
}
EOF
)"
  1. Retrieve the value using the CLI to confirm formatting is preserved:
airflow variables get x

Expected output:

{
  "key": "val",
  "key2": "val2"
}
  1. Open the Airflow UI and navigate to Admin → Variables.
  2. Locate and view the same variable in the UI.
  3. Observed behavior:
Image

Operating System

Docker Image

Versions of Apache Airflow Providers

No response

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

No one assigned

    Labels

    area:UIRelated to UI/UX. For Frontend Developers.area:corekind:bugThis is a clearly a bugneeds-triagelabel for new issues that we didn't triage yet

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions