Skip to content

Make the "Invalid JSON" validation warning on the Edit Variable form more prominent (and block/guard Save) #68262

Closed

Description

@zachliu

Description

On the Edit Variable modal (Airflow 3.x UI), when a variable's value is not valid JSON, the UI displays a small, low-contrast "Invalid JSON" message in plain text directly beneath the value textarea. This warning is very easy to overlook:

  • The text is small and positioned below the input, outside the user's focal area when they are looking at the value field or the Save button.
  • There is no accompanying icon, colored banner, or border highlight to draw attention.
  • The Save button remains fully enabled and visually unchanged, so the message reads as informational rather than as a blocking error.

As a result, a user can edit a variable, introduce a malformed-JSON value (e.g. a trailing comma), see no obvious obstacle, click Save, and persist a broken value without ever registering that the UI tried to warn them.

Image

Proposed improvements (any subset would help):

  1. Elevate the warning to a prominent inline error state, e.g. a red border on the textarea, an error icon, and a clearly styled message, consistent with how other form validation errors are surfaced.
  2. Disable the Save button (or show a confirmation dialog) while the value fails JSON validation, if the variable is intended to be stored as JSON. Plain-string variables should still be saveable.
  3. Optionally, point to the location/line of the parse error to help users fix it quickly.

Use case/motivation

Airflow Variables are frequently used to store JSON configuration that DAGs deserialize at runtime via Variable.get(key, deserialize_json=True). These variables are often edited directly in the UI by operators who are not the original authors of the DAG code.

When a malformed-JSON value is saved:

  • The variable is stored as an invalid string.
  • DAGs that deserialize it fail at runtime and depending on the DAG's error handling, may silently fall back to a default/empty value rather than failing loudly. This can route work to the wrong destination (e.g. a wrong S3 bucket) or skip records entirely.
  • The root cause (a single stray character in the variable) is hard to trace, because the failure surfaces downstream in the DAG, far from the edit action that caused it.

We hit exactly this: an operator edited a JSON variable in the UI, a trailing comma made the value invalid, and the "Invalid JSON" warning went unnoticed because Save stayed enabled. The variable saved, downstream DAGs fell back to a default value, and the failure showed up hours later as a confusing "missing S3 bucket" error that took multiple people to diagnose.

A more prominent warning, and ideally a guarded Save, would have stopped the bad value at the source and prevented the downstream incident entirely. This is a small UI change that meaningfully reduces a whole
class of hard-to-diagnose, operator-introduced production failures.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:feature
    needs-triage
    on Jun 9, 2026
  2. added
    area:UI
    on Jun 9, 2026
  3. eddiesr93 commented on Jul 20, 2026

    @eddiesr93
    Contributor

    This looks resolved by #68268 (merged 2026-06-22). That PR did not use a closing keyword, which is why this issue stayed open.

    Against the three proposals in the description:

    1. Prominent inline error state — shipped. The invalid-JSON feedback now renders through the shared Alert component directly beneath the value field.
    2. Blocking Save — deliberately not shipped. The stated intent of Better warning visibility for invalid JSON value when editing variables #68268 was to "keep the invalid JSON feedback as a visible warning instead of a blocking validation error", and VariableForm.test.tsx pins that behaviour: Jinja templates ({{ var.value.x }}) and bracket-prefixed plain strings ([DRAFT] ...) are not valid JSON but are legitimate variable values, so Save stays enabled for them.
    3. Pointing at the parse error location — not implemented; the message is still a fixed string.

    So the visibility half of this request has shipped, and the Save-guard half was closed off by design. Item 3 is the only part still open, if it is still wanted.


    Drafted-by: Claude Code (Opus 4.8) (no human review before posting)

  4. added a commit that references this issue on Aug 21, 2026
    b5b39cc
  5. added a commit that references this issue on Aug 21, 2026
    1a19556
  6. added a commit that references this issue on Aug 24, 2026
    557c94c
  7. added a commit that references this issue on Sep 7, 2026
    9e52db8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:UIkind:featureneeds-triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions