Presto queries resulting in errors after upgrading to 49.7

We recently upgraded our metabase version to 49.7 and all our DBs are working fine except queries which are running on presto. We are not able to understand the root cause. Could you please help?
Below is the error in the logs.

status :failed,
 :class java.lang.RuntimeException,
 :stacktrace
 ["com.facebook.presto.jdbc.internal.client.StatementClientV1.requestFailedException(StatementClientV1.java:497)"
  "com.facebook.presto.jdbc.internal.client.StatementClientV1.advance(StatementClientV1.java:420)"
  "com.facebook.presto.jdbc.PrestoResultSet.getColumns(PrestoResultSet.java:1743)"
  "com.facebook.presto.jdbc.PrestoResultSet.<init>(PrestoResultSet.java:121)"
  "com.facebook.presto.jdbc.PrestoStatement.internalExecute(PrestoStatement.java:272)"
  "com.facebook.presto.jdbc.PrestoStatement.execute(PrestoStatement.java:230)"
  "com.facebook.presto.jdbc.PrestoPreparedStatement.<init>(PrestoPreparedStatement.java:85)"
  "com.facebook.presto.jdbc.PrestoConnection.prepareStatement(PrestoConnection.java:165)"
  "com.facebook.presto.jdbc.PrestoConnection.prepareStatement(PrestoConnection.java:358)"
  "com.mchange.v2.c3p0.impl.NewProxyConnection.prepareStatement(NewProxyConnection.java:385)"
  "--> driver.presto_jdbc$fn__125058.invokeStatic(presto_jdbc.clj:641)"
  "driver.presto_jdbc$fn__125058.invoke(presto_jdbc.clj:637)"
  "driver.sql_jdbc.execute$prepared_statement_STAR_$fn__79313.invoke(execute.clj:531)"
  "driver.sql_jdbc.execute$prepared_statement_STAR_.invokeStatic(execute.clj:530)"
  "driver.sql_jdbc.execute$prepared_statement_STAR_.invoke(execute.clj:527)"
  "driver.sql_jdbc.execute$statement_or_prepared_statement.invokeStatic(execute.clj:553)"
  "driver.sql_jdbc.execute$statement_or_prepared_statement.invoke(execute.clj:548)"
  "driver.sql_jdbc.execute$execute_reducible_query$fn__79404.invoke(execute.clj:698)"
  "driver.presto_jdbc$fn__125076$fn__125077.invoke(presto_jdbc.clj:714)"
  "driver.sql_jdbc.execute$do_with_resolved_connection.invokeStatic(execute.clj:335)"
  "driver.sql_jdbc.execute$do_with_resolved_connection.invoke(execute.clj:318)"
  "driver.presto_jdbc$fn__125076.invokeStatic(presto_jdbc.clj:707)"
  "driver.presto_jdbc$fn__125076.invoke(presto_jdbc.clj:694)"
  "driver.presto_jdbc$fn__125076.invokeStatic(presto_jdbc.clj:701)"
  "driver.presto_jdbc$fn__125076.invoke(presto_jdbc.clj:694)"
  "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:693)"
  "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:679)"
  "driver.sql_jdbc.execute$execute_reducible_query.invokeStatic(execute.clj:690)"
  "driver.sql_jdbc.execute$execute_reducible_query.invoke(execute.clj:679)"
  "driver.sql_jdbc$fn__106749.invokeStatic(sql_jdbc.clj:78)"
  "driver.sql_jdbc$fn__106749.invoke(sql_jdbc.clj:76)"
  "query_processor.context$executef.invokeStatic(context.clj:60)"
  "query_processor.context$executef.invoke(context.clj:49)"
  "query_processor.context.default$default_runf.invokeStatic(default.clj:44)"
  "query_processor.context.default$default_runf.invoke(default.clj:42)"
  "query_processor.context$runf.invokeStatic(context.clj:46)"
  "query_processor.context$runf.invoke(context.clj:40)"
  "query_processor.reducible$identity_qp.invokeStatic(reducible.clj:39)"
  "query_processor.reducible$identity_qp.invoke(reducible.clj:36)"
  "query_processor.middleware.cache$maybe_return_cached_results$maybe_return_cached_results_STAR___72237.invoke(cache.clj:229)"
  "query_processor.middleware.permissions$check_query_permissions$fn__66594.invoke(permissions.clj:140)"
  "query_processor.middleware.enterprise$check_download_permissions_middleware$fn__72058.invoke(enterprise.clj:51)"
  "query_processor.middleware.enterprise$maybe_apply_column_level_perms_check_middleware$fn__72068.invoke(enterprise.clj:64)"
  "query_processor.middleware.mbql_to_native$mbql__GT_native$fn__71500.invoke(mbql_to_native.clj:24)"
  "query_processor$fn__73405$combined_post_process__73410$combined_post_process_STAR___73411.invoke(query_processor.clj:262)"
  "query_processor$fn__73405$combined_pre_process__73406$combined_pre_process_STAR___73407.invoke(query_processor.clj:259)"
  "query_processor.middleware.fetch_source_query$resolve_card_id_source_tables$fn__66691.invoke(fetch_source_query.clj:303)"
  "query_processor.middleware.resolve_database_and_driver$resolve_driver_and_database_local_values$fn__72148$fn__72152.invoke(resolve_database_and_driver.clj:77)"
  "driver$do_with_driver.invokeStatic(driver.clj:97)"
  "driver$do_with_driver.invoke(driver.clj:92)"
  "query_processor.middleware.resolve_database_and_driver$resolve_driver_and_database_local_values$fn__72148.invoke(resolve_database_and_driver.clj:76)"
  "query_processor.middleware.store$initialize_store$fn__67318$fn__67319.invoke(store.clj:14)"
  "query_processor.store$do_with_metadata_provider.invokeStatic(store.clj:169)"
  "query_processor.store$do_with_metadata_provider.invoke(store.clj:150)"
  "query_processor.store$do_with_metadata_provider.invokeStatic(store.clj:158)"
  "query_processor.store$do_with_metadata_provider.invoke(store.clj:150)"
  "query_processor.middleware.store$initialize_store$fn__67318.invoke(store.clj:13)"
  "query_processor.middleware.resolve_database_and_driver$resolve_database$fn__72145.invoke(resolve_database_and_driver.clj:60)"
  "query_processor.middleware.normalize_query$normalize$fn__72450.invoke(normalize_query.clj:38)"
  "query_processor.middleware.enterprise$fn__72085$handle_audit_app_internal_queries__72086$fn__72088.invoke(enterprise.clj:96)"
  "query_processor.middleware.enterprise$handle_audit_app_internal_queries_middleware$fn__72096.invoke(enterprise.clj:103)"
  "query_processor.middleware.constraints$mark_needs_default_userland_constraints$fn__71211.invoke(constraints.clj:104)"
  "query_processor.middleware.process_userland_query$process_userland_query$fn__72381.invoke(process_userland_query.clj:156)"
  "query_processor.middleware.catch_exceptions$catch_exceptions$fn__72982.invoke(catch_exceptions.clj:171)"
  "query_processor.reducible$async_qp$qp_STAR___62832$thunk__62834.invoke(reducible.clj:126)"
  "query_processor.reducible$async_qp$qp_STAR___62832$fn__62836.invoke(reducible.clj:131)"],
 :card_id 17492,
 :context :question,
 :error "Error executing query",
 :row_count 0,
 :running_time 0,
 :data {:rows [], :cols []}}

Here is the diagnostic info as well.

{
  "browser-info": {
    "language": "en-GB",
    "platform": "MacIntel",
    "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36",
    "vendor": "Google Inc."
  },
  "system-info": {
    "file.encoding": "UTF-8",
    "java.runtime.name": "OpenJDK Runtime Environment",
    "java.runtime.version": "11.0.22+7",
    "java.vendor": "Eclipse Adoptium",
    "java.vendor.url": "https://adoptium.net/",
    "java.version": "11.0.22",
    "java.vm.name": "OpenJDK 64-Bit Server VM",
    "java.vm.version": "11.0.22+7",
    "os.name": "Linux",
    "os.version": "5.10.226-214.879.amzn2.x86_64",
    "user.language": "en",
    "user.timezone": "Asia/Calcutta"
  },
  "metabase-info": {
    "databases": [
      "postgres",
      "presto-jdbc"
    ],
    "hosting-env": "unknown",
    "application-database": "postgres",
    "application-database-details": {
      "database": {
        "name": "PostgreSQL",
        "version": "14.12"
      },
      "jdbc-driver": {
        "name": "PostgreSQL JDBC Driver",
        "version": "42.7.2"
      }
    },
    "run-mode": "prod",
    "version": {
      "date": "2024-04-22",
      "tag": "v0.49.7",
      "hash": "f0ff786"
    },
    "settings": {
      "report-timezone": "Asia/Calcutta"
    }
  }
}

Please upgrade to 49.30 and also send us some details about the card, presto version and more

@Luiggi The presto version is 0.288-15f14bb, and the card is a query which has parametrized filters one of which is a timestamp field. When we hardcode these filters, the query seems to be working. We tried changing type of this field in the table metadata but to no avail. So, moving to 49.30 should removed these issues for us?

ok interesting, how big is the SQL query?

@Luiggi 473 lines formatted, 97 lines unformatted. This did not just happen for one query, but many queries. and we needed parameterized filters to ensure our dashboard subscriptions keep working

we have reverted back to our old version which is working fine for all queries for the same presto version. so we were thinking, got to do with something how metabase is connecting with presto and parsing the queries/parameters

we had many customers that had the same thing and it was always due to the size of the headers...

@Luiggi so queries in size bigger than a threshold fails?

yes, but it's a presto issue