private void recoverInvalidScheduledQueryState(int timeoutSecs) {
    int maxLastUpdateTime = (int) (System.currentTimeMillis() / 1000) - timeoutSecs;
    try (QueryWrapper q = new QueryWrapper(pm.newQuery(MScheduledQuery.class))) {
      q.setFilter("activeExecution != null");

      List<MScheduledQuery> results = (List<MScheduledQuery>) q.execute();
      for (MScheduledQuery e : results) {
        Integer lastUpdateTime = e.getActiveExecution().getLastUpdateTime();
        if (lastUpdateTime == null || lastUpdateTime < maxLastUpdateTime) {
          LOG.error("Scheduled query: {} stuck with an activeExecution - clearing",
              scheduledQueryKeyRef(e.getScheduleKey()));
          e.setActiveExecution(null);
          pm.makePersistent(e);
        }
      }
    }
  }
Abbreviates the error message to the given size.

There might be error messages which may also contain a stack trace.
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java