airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Combined length of DAG tags cannot exceed 100 characters

Open techgnosis opened this issue 1 year ago • 8 comments

Apache Airflow version

3.0.6

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

No response

What happened?

Airflow currently enforces a limit where the combined length of all tags for a DAG cannot exceed 100 characters. If this limit is exceeded, an error occurs and the DAG is not accepted.

What you think should happen instead?

Airflow should either support a higher combined length for DAG tags or provide a clearer error message/documentation about this limitation.

How to reproduce

Create a DAG with tags whose combined length exceeds 100 characters. Attempt to load the DAG in Airflow.

Operating System

Astrononer Runtime

Versions of Apache Airflow Providers

No response

Deployment

Astronomer

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

techgnosis avatar Sep 15 '25 17:09 techgnosis

Dear @techgnosis, I am interested on taking this PR. Here is what I'm planning to complete this request.

Problem

Currently Airflow has a hard limit of 100 characters for combined length of all DAG tags. This is quite restrictive and causes issues when users want to add descriptive tags to their DAGs. When this limit is exceeded, the DAG fails to load without any clear error message.

What I'm planning to do

  1. Increase the character limit from 100 to 500 characters for combined DAG tags
  2. Add proper validation with clear error messages when limit is exceeded
  3. Update documentation to mention this limitation
  4. Add unit tests to verify the new limit works correctly

Approach

  • First, I'll find where this 100-character limit is enforced in the codebase
  • Update the validation logic to use 500 characters instead
  • Add better error messages that tell users exactly what went wrong
  • Write tests to ensure the new limit works properly
  • Update any relevant documentation

Files I expect to modify

  • DAG validation logic (probably in airflow/models/dag.py)
  • Error handling for tag validation
  • Unit tests for DAG tag validation
  • Documentation files

Testing plan

  • Create test DAGs with tags totaling exactly 500 characters (should work)
  • Create test DAGs with tags totaling 501+ characters (should fail with clear error)
  • Verify existing functionality still works
  • Test edge cases

This will give users much more flexibility in tagging their DAGs while still maintaining reasonable limits.

Thank you Siddharthan P S

sidshas03 avatar Sep 16 '25 00:09 sidshas03

@sidshas03, please feel free to open a PR for this issue!

jroachgolf84 avatar Sep 16 '25 20:09 jroachgolf84

Update: I’ve opened PR #55750 to resolve this.

  • Clarifies the limit is per tag (100 chars), not combined

  • Adds early validation in the SDK DAG path and raises an AirflowException naming the offending tag (short preview) and its actual length

  • Adds a concise docs note under core DAG concepts about the 100-char per-tag limit

  • Includes unit tests:

    • 100 chars → allowed
    • 101 chars → fails with clear message
    • multiple tags with one too long → fails and identifies the long tag

No DB/schema changes; this aligns with the existing dag_tag.name VARCHAR(100) constraint.

PR: #55750 — includes Resolves #55693 If the community prefers increasing the limit, I’m happy to follow up with a separate proposal + migration after this UX fix.

Looking forward to your reply @techgnosis @jroachgolf84, thank you so much for this - sorry for the earlier confusion.

sidshas03 avatar Sep 17 '25 04:09 sidshas03

This issue has been automatically marked as stale because it has been open for 365 days without any activity. There has been several Airflow releases since last activity on this issue. Kindly asking to recheck the report against latest Airflow version and let us know if the issue is reproducible. The issue will be closed in next 30 days if no further activity occurs from the issue author.

github-actions[bot] avatar Sep 17 '26 07:09 github-actions[bot]

Hi, I'm a student contributor looking at this as a possible first issue, and I wanted to check it's still wanted before I open a PR. I reproduced it on main and the limit is per tag, not combined. A Dag with six tags totalling 162 characters loads fine, but a single 101 character tag fails with the generic tag cannot be longer than 100 characters. That matches TAG_MAX_LEN = 100 and the dag_tag.name column. PR #55750 took the clearer error approach and got good review feedback before going stale, but the issue is still needs-triage. Is it free to take, and is the clearer error plus docs the fix you want, or would you rather raise the limit? I know raising it would need a DB migration. If the clearer error scope is right I'm happy to open a PR rebasing that approach onto current main. Thanks!

Duke2nuke avatar Nov 12 '26 08:11 Duke2nuke

Hi, just checking in on this one. I posted a few days ago asking if the tag limit issue is still free and whether a clearer error or docs note is the right fix. Happy to open a PR once you say yes.

Duke2nuke avatar Nov 19 '26 16:11 Duke2nuke

Hi, I would like to work on this issue.

I plan to investigate the current DAG tag length validation and improve the handling of cases where the combined tag length exceeds the 100-character limit.

I will also add unit tests to cover the validation behavior and ensure that the error message clearly explains the limitation.

Please let me know if this approach sounds good. Thank you!

KhaiLe-newbie avatar Nov 24 '26 15:11 KhaiLe-newbie

A fix is proposed in #77676. The error message now names the offending tag, its actual length, and the per-tag limit, and the implementation incorporates the feedback from the earlier attempt in #55750 (ValueError, no new files, tests in the existing parametrized test).

rmfrall avatar Nov 27 '26 12:11 rmfrall