public Optional<Throwable> getFailureCause() {
    return Optional.ofNullable(
        stateMachine.getFailureCauses().stream()
            .filter(e -> e instanceof IoTDBException || e instanceof IoTDBRuntimeException)
            .findFirst()
            .orElse(stateMachine.getFailureCauses().peek()));
  }
return List of specific throwable and stack trace
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/fragment/FragmentInstanceContext.java