# Error while deploying tutorial & possible bug in tutorial's withdraw()

**URL:** <https://forum.flow.com/t/error-while-deploying-tutorial-possible-bug-in-tutorials-withdraw/707>\
**Category:** Flow Playground\
**Created:** [December 29, 2020, 1:37pm UTC](https://forum.flow.com/t/error-while-deploying-tutorial-possible-bug-in-tutorials-withdraw/707 "2020-12-29T13:37:53Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kalin](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/kalin/32/212_2.png) [@Kalin](https://forum.flow.com/u/Kalin)\
**Post date:** [December 29, 2020, 1:37pm UTC](https://forum.flow.com/t/error-while-deploying-tutorial-possible-bug-in-tutorials-withdraw/707/1 "2020-12-29T13:37:53Z")

</div>

Hello everyone, two things:

1. I’ve just stared playing around and unfortunately I came across this message on the first step of **Fungible Token** tutorial (deploying FungibleToken.cdc on account 0x01):  

2. Also, it looks to me that the **withdraw()** function from **Vault** resource has a bug (when triggered with amount higher than the actual **balance** it will safely set balance to zero but it will also create a new **Vault** with amount created out of thin air).  
I guess to prevent this, **Provider** or **Vault** itself should have additional _pre-condition_ like:

```auto
        pre {
            self.balance >= amount:
                "Balance must be equal or higher than the withdrawal amount"
        }

```

Or am I missing something? (couldn’t test this myself because of the issue above).

---

<div class="post-metadata">

**Author:** ![unlocked](https://avatars.discourse-cdn.com/v4/letter/u/3be4f8/32.png) [@unlocked](https://forum.flow.com/u/unlocked)\
**Post date:** [December 29, 2020, 5:24pm UTC](https://forum.flow.com/t/error-while-deploying-tutorial-possible-bug-in-tutorials-withdraw/707/2 "2020-12-29T17:24:38Z")

</div>

tagging @flowjosh and @MaxStarka

---

<div class="post-metadata">

**Author:** ![flowjosh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.flow.com/flowjosh/32/362_2.png) [@flowjosh](https://forum.flow.com/u/flowjosh)\
**Post date:** [January 4, 2021, 4:21pm UTC](https://forum.flow.com/t/error-while-deploying-tutorial-possible-bug-in-tutorials-withdraw/707/3 "2021-01-04T16:21:29Z")

</div>

@Kalin you are correct that it would need that pre-condition. It will fail if the amount is greater than the balance anyway because it would underflow, but it is better to include as a precondition so there are better error messages. It is included in the Flow FungibleToken standard [here](https://github.com/onflow/flow-ft/blob/master/contracts/FungibleToken.cdc#L170)

We’re looking into the graphQL bug. 👍
