# Cloud Variable Bug

**URL:** <https://community.thunkable.com/t/cloud-variable-bug/563953>\
**Category:** Questions about Thunkable X\
**Created:** [April 23, 2020, 2:49pm UTC](https://community.thunkable.com/t/cloud-variable-bug/563953 "2020-04-23T14:49:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Wolber](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/david_wolber/32/117458_2.png) [@David\_Wolber](https://community.thunkable.com/u/David_Wolber)\
**Post date:** [April 23, 2020, 2:49pm UTC](https://community.thunkable.com/t/cloud-variable-bug/563953/1 "2020-04-23T14:49:21Z")

</div>

When I create a cloud variable and Thunkable live is open, I can’t get it to initialize correctly. If I add the same cloud variable and code with Thunkable Live closed, then open Thunkable Live, it works.  
Here is a more [detailed description](https://docs.google.com/document/d/1WhOOOU0thltfptsrmhSSo-a0T2hUr0RK5lpRXp4t-no/edit?usp=sharing) with sample app and video

---

<div class="post-metadata">

**Author:** ![paulmw](https://avatars.discourse-cdn.com/v4/letter/p/22d042/32.png) [@paulmw](https://community.thunkable.com/u/paulmw)\
**Post date:** [April 24, 2020, 4:23am UTC](https://community.thunkable.com/t/cloud-variable-bug/563953/2 "2020-04-24T04:23:26Z")

</div>

Hmm…ok, we’ll fix that.

**An explanation of what’s happening:**  
In the video thunkBug1.mp4, the problem occurs at 1 minute 32 seconds into the video. Since Thunkable Live is open, it runs the code every time the blocks update. When the code runs with what you see at 1:32, the cloud variable’s value is set to 0 (the default when nothing is attached). Then, when you put the blocks into it, since your variable is defined as 0, the code doesn’t run since the variable isn’t defined as null.

**Temporary fixes you can do**

1. Construct the set block before putting it in the event
2. Check for null or 0 in the conditional

**Our long term fix**  
We should have the block not run when nothing is attached instead of setting the value to 0.

---

<div class="post-metadata">

**Author:** ![David\_Wolber](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/david_wolber/32/117458_2.png) [@David\_Wolber](https://community.thunkable.com/u/David_Wolber)\
**Post date:** [April 24, 2020, 3:43pm UTC](https://community.thunkable.com/t/cloud-variable-bug/563953/3 "2020-04-24T15:43:33Z")

</div>

Great and thanks Paul, very interesting!

One additional piece of info-- I was doing a Technovation live demo of this previously and got the error. Unlike the video I sent you, I constructed the init blocks outside of the event handler (gray) before putting them in the event handler. So temporary fix #1 may not work-- maybe blocks outside of the event do get executed? The demo is at [https://www.youtube.com/watch?v=zisCStLeL8Q](https://www.youtube.com/watch?v=zisCStLeL8Q) and the error starts about 27:05

Hope you’re enjoying it here–its better if you can go outside of course 😀

---

<div class="post-metadata">

**Author:** ![David\_Wolber](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/david_wolber/32/117458_2.png) [@David\_Wolber](https://community.thunkable.com/u/David_Wolber)\
**Post date:** [April 24, 2020, 3:57pm UTC](https://community.thunkable.com/t/cloud-variable-bug/563953/4 "2020-04-24T15:57:00Z")

</div>

Two more thoughts:

1. Inserting into variables that haven’t been initialized as lists is one of the most common errors students get. I wonder if it would be better to allow the operation and convert the variable into a list automatically

2. The lack of Run-time error reporting is frustrating

3. Once you connect app to Firebase you can view cloud data while debugging. But prior to that, and for most beginners exploring cloud variables, there isn’t a view of the default db. That view would be huge for debugging.

---

<div class="post-metadata">

**Author:** ![ioannis](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/ioannis/32/146956_2.png) [@ioannis](https://community.thunkable.com/u/ioannis)\
**Post date:** [November 8, 2024, 11:31am UTC](https://community.thunkable.com/t/cloud-variable-bug/563953/5 "2024-11-08T11:31:52Z")

</div>


