Low severityconfiguration
Power BI Refresh Error:
QUERY_TAG_TOO_LONG
What does this error mean?
A Snowflake session or statement failed to set a QUERY_TAG because the tag value exceeded Snowflake's maximum allowed length of 2000 characters, causing the tag assignment to be rejected.
Common causes
- 1An orchestration tool or dbt adapter automatically generates a QUERY_TAG containing the full query text, SQL hash, run metadata, or a serialized JSON blob that exceeds 2000 characters
- 2A dbt project configured with a custom query_tag macro includes verbose context such as stack traces or full model SQL that can grow beyond the limit on complex models
- 3A developer set a query tag via ALTER SESSION SET QUERY_TAG = '...' with a JSON payload that was not length-checked before assignment
How to fix it
- 1Step 1: Verify the current query tag value length: SELECT LEN(CURRENT_QUERY_TAG()).
- 2Step 2: For dbt projects, update the generate_query_tag macro in your dbt project to truncate or summarize the tag payload to under 2000 characters.
- 3Step 3: If using an orchestration tool, check its Snowflake query tagging configuration and reduce the fields included in the tag, keeping it to essential identifiers (job name, run ID, user).
- 4Step 4: Reset the query tag to a valid value: ALTER SESSION SET QUERY_TAG = '<truncated_value>'.