MetricSign
EN|NLRequest Access
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

  1. 1Step 1: Verify the current query tag value length: SELECT LEN(CURRENT_QUERY_TAG()).
  2. 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.
  3. 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).
  4. 4Step 4: Reset the query tag to a valid value: ALTER SESSION SET QUERY_TAG = '<truncated_value>'.

Frequently asked questions

Does a query tag error cause the query to fail?

In some Snowflake driver versions, an invalid query tag raises an error that aborts the query. In others, the tag is silently truncated or ignored. Check your Snowflake driver version for the specific behavior.

What is the recommended structure for a Snowflake query tag?

A compact JSON object with key identifiers such as app name, job name, run ID, and user typically stays well under 2000 characters and provides sufficient context for QUERY_HISTORY analysis.

Other configuration errors