# Error before bootstrapping

**URL:** <https://openfhe.discourse.group/t/error-before-bootstrapping/434>\
**Category:** Library Questions\
**Created:** [March 27, 2023, 9:52pm UTC](https://openfhe.discourse.group/t/error-before-bootstrapping/434 "2023-03-27T21:52:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![narger](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/narger/32/420_2.png) [@narger](https://openfhe.discourse.group/u/narger)\
**Post date:** [March 27, 2023, 9:52pm UTC](https://openfhe.discourse.group/t/error-before-bootstrapping/434/1 "2023-03-27T21:52:25Z")

</div>

Hello there, here I am again 😃

I am getting this error before launching the simple 1-iteration bootstrap function:

_[…]/dcrtpoly.cpp:385 DCRTPolyImpl’s towers are not initialized._

But I also noticed that, if I don’t run a multiplication before, the bootstrapping runs fine. I was wondering what kind of error is that and how can I interpret it? (I am at the last level of the circuit with that mult, could that be the problem?)

---

<div class="post-metadata">

**Author:** ![iquah](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/iquah/32/8_2.png) [@iquah](https://openfhe.discourse.group/u/iquah)\
**Post date:** [March 27, 2023, 10:13pm UTC](https://openfhe.discourse.group/t/error-before-bootstrapping/434/2 "2023-03-27T22:13:34Z")

</div>

Please share a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example)

---

<div class="post-metadata">

**Author:** ![narger](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/narger/32/420_2.png) [@narger](https://openfhe.discourse.group/u/narger)\
**Post date:** [March 28, 2023, 3:00pm UTC](https://openfhe.discourse.group/t/error-before-bootstrapping/434/3 "2023-03-28T15:00:26Z")

</div>

I’m pretty sure that this happens when you try to bootstrap a ciphertext that is on the last level.

```auto
Ctxt value = HEController::encrypt_repeated(1);
cout << "Depth: " << depth
cout << "Level: " << value->GetLevel() << endl;
for (int i = 0; i < depth - 1; i++) {
     value = HEController::mult(value, value);
}
cout << "Level: " << value->GetLevel() << endl;
HEController::bootstrap(value);
HEController::print_slotted(value, 1, 1);
cout << "Done";

```

I am using HEController class for convenience. This code runs fine:

```auto
Depth: 30
Level: 0
Level: 28

```

However, if I run the for loop one time more, it gives the error:

```auto
Ctxt value = HEController::encrypt_repeated(1);
cout << "Depth: " << depth
cout << "Level: " << value->GetLevel() << endl;
for (int i = 0; i < depth; i++) {
     value = HEController::mult(value, value);
}
cout << "Level: " << value->GetLevel() << endl;
HEController::bootstrap(value);
HEController::print_slotted(value, 1, 1);
cout << "Done";

```

The output:

```auto
Depth: 30
Level: 0
Level: 29
libc++abi: terminating with uncaught exception of type lbcrypto::config_error: /Users/narger/Documents/Università/openfhe-development/src/core/lib/lattice/hal/default/dcrtpoly.cpp:385 DCRTPolyImpl's towers are not initialized.

```

The decryption works fine though. I think this could be the right behavior, I just don’t know how to interpret the error, that’s it! Telling the user that (s)he can not perform the bootstrap because of the level could be a more useful message, but I am a newbie, just playing here and there 😃

---

<div class="post-metadata">

**Author:** ![saroja](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@saroja](https://openfhe.discourse.group/u/saroja)\
**Post date:** [March 29, 2023, 5:22pm UTC](https://openfhe.discourse.group/t/error-before-bootstrapping/434/4 "2023-03-29T17:22:18Z")

</div>

Yes, this is the correct behavior, but the error message is confusing. We added an issue for it: [Exception message in bootstrapping · Issue #351 · openfheorg/openfhe-development · GitHub](https://github.com/openfheorg/openfhe-development/issues/351)

---

<div class="post-metadata">

**Author:** ![narger](https://yyz1.discourse-cdn.com/flex031/user_avatar/openfhe.discourse.group/narger/32/420_2.png) [@narger](https://openfhe.discourse.group/u/narger)\
**Post date:** [March 30, 2023, 9:06am UTC](https://openfhe.discourse.group/t/error-before-bootstrapping/434/5 "2023-03-30T09:06:32Z")

</div>

Ok, good! Thanks for the quick support!
