# Tips and Troubleshooting

* Many times new allocations are created and allocation error is still shown.Try to use `./zbox listallocations` to cross-check whether an allocation is created
* Check your wallet balance using `./zwallet getbalance` before creating an allocation and see whether you have the required amount of tokens to lock for allocation. If not having tokens use the faucet`./zwallet faucet --methodName pour --input "{Pay day}"`command.

### Error 1-Error creating allocation: transaction\_not\_found: Transaction was not found on any of the sharders

#### Cause 1:Your write tokens has expired

Write tokens are required and locked into a write pool using a `--lock` flag whenever the new allocation is created. There can be an instance where you are not able to create allocation since locked write tokens have expired with the allocation.

To get the write pool information(expiry, how many locked tokens) for all allocations.

Command:

```
  ./zbox wp-info
```

Sample Response:

```
- id:             6c2b94419c2b94b4dd4afc4d41f25509a33bd32c6150114edaf016f54e866eb0
  balance:        0.2
  expire_at:      2021-05-06 21:12:03 +0000 UTC
  allocation_id:  6c2b94419c2b94b4dd4afc4d41f25509a33bd32c6150114edaf016f54e866eb0
  locked:         true
  blobbers:
  - blobber_id:  090dc72b647638509a02185dcc2ac031ee35117e27cd2e332e38d8445edc740d
  - balance:     0.0422620713
  - blobber_id:  3b0551d5ecea77e9c9ed77c72eb114b2345fface766ef2ac5883096e160f64d7
  - balance:     0.0422620713
  - blobber_id:  76be262c6113a3b4656c6ecf5ed6bccff3fb2d7a1952891296ccc03be87a243e
  - balance:     0.0743812465
  - blobber_id:  b94cb2f4a689d1af305550a9ee69fc561ad49e699fe265fca4dc0a6a4b66a458
  - balance:     0.0410946107
- id:             bbb902ef735d4e1c904f096ccc1e3e52d5514ded32b0cc4f3cdcdb9d77203362
  balance:        0.2
  expire_at:      2021-05-06 20:59:26 +0000 UTC
  allocation_id:  bbb902ef735d4e1c904f096ccc1e3e52d5514ded32b0cc4f3cdcdb9d77203362
  locked:         true
  blobbers:
  - blobber_id:  2efc85d6a2f36380e1e77b843cd9f4fe55668271cae4925ab38a92504176e5df
  - balance:     0.0741096832
  - blobber_id:  91684b1f9b8d0e785afab38645e5bc6e2d77619d9b26c49325e15977568c2ade
  - balance:     0.042837967
  - blobber_id:  ac808ceeeba1026fbd9d1e495508af496aacc6f11a58fd202ea9f032a2419648
  - balance:     0.0421077739
  - blobber_id:  b94cb2f4a689d1af305550a9ee69fc561ad49e699fe265fca4dc0a6a4b66a458
  - balance:     0.0409445757
​
​
```

For a Particular allocation write pool information use:

```
  ./zbox wp-info --allocation $ALLOCATION_ID
```

If there are no write tokens locked in a pool with an allocation. You can lock them using

```
  ./zbox wp-lock --allocation ALLOCATION_ID --duration 40m --tokens 1
```

All the tokens will be divided between allocation blobbers depending on their write price.

To unlock an expired write pool, associated with an allocation use

```
./zbox wp-unlock --pool_id POOL_ID
```

#### Cause 2:Blobber has run out of Staked Capacity

If unable to create new allocations as shown below:

Command:

```
zbox newallocation --lock 0.5
​
```

Response:

```
Error creating allocation: transaction_not_found: Transaction was not found on any of the sharders
```

To fix this issue, You must lock some tokens on the blobber. Through zbox, it can be done using the `sp-lock` command

You have to get the blobber id which can be found using `./zbox ls-blobbers`command. The response will output all active blobbers but here in the sample response we have mentioned one of the blobbers

Response:

```
- id:                    011a5444c9fe53137da7c3d871f3bf4bbf3c01607b14aa95ff2de43b5537d4b6
  url:                   http://one.devnet-0chain.net:31305
  used / total capacity: 238.9 GiB / 1000.0 GiB
  terms:
    read_price:          0.01 tok / GB
    write_price:         0.01 tok / GB / time_unit
    min_lock_demand:     0.1
    cct:                 2m0s
    max_offer_duration:  744h0m0s
​
```

Now lets use the `sp-lock` command with above blobber\_id to lock tokens.

Command:

```
./zbox sp-lock --blobber_id --tokens 0.5 011a5444c9fe53137da7c3d871f3bf4bbf3c01607b14aa95ff2de43b5537d4b6 
```

Response:

```
tokens locked, pool id: e4ca6db2dc067b71fcbcd98a9b437dfa18f61632c69ba35bf19821678bd357d7
​
```

You can also use `sp-info` command for finding the stake pool info(total stake, capacity and write price) for a blobber.

```
./zbox sp-info --blobber_id 011a5444c9fe53137da7c3d871f3bf4bbf3c01607b14aa95ff2de43b5537d4b6
```

Response:

```
blobber_id:             011a5444c9fe53137da7c3d871f3bf4bbf3c01607b14aa95ff2de43b5537d4b6
total stake:            5
going to unlock, total: 0
capacity:
  free:        263.1 GiB (for current write price)
  capacity:    1000.0 GiB (blobber bid)
  write_price: 0.01 (blobber write price)
- lock:       0.0033333333
  expire:     2021-05-21 08:18:28 +0000 UTC
  allocation: f4d589407769e33267521cfb63d1ba6220708801b9fc843be7b572d4ce46f457
  expired:    false
offers_total: 2.36851183 (held by opened offers)
delegate_pools:
- id:                9de14085f547ca57b954f262f44e31e98a6281a1db0b5dbfa838bd392d764b92
  balance:           1
  delegate_id:       242d1a3002804da81b9b3960b9f5d9282466a65d0eb3e8b81513cc279747f5af
  rewards:           0.0000923483
  penalty:           0
  interests:         0.078156 (payed)
  pending_interests: 0.2087166 (not payed yet, can be given by 'sp-pay-interests' command)
  going to unlock at: <not going>
- id:                d7a1d4d325503f68228bf9a11da7c34b7ce2241e59f22a10b56a13e23ac8f017
  balance:           2
  delegate_id:       7875e1cce7e8aa4397d8e1251f95cf97c8c7495fca7c793777b310a4d6a66eda
  rewards:           0.0002324521
  penalty:           0
  interests:         0.2873736 (payed)
  pending_interests: 0.4174332 (not payed yet, can be given by 'sp-pay-interests' command)
  going to unlock at: <not going>
- id:                b1e5f86af8b39d6486f69c03a078b3b6ae3129557a0fbc18cbb73967cbf6c206
  balance:           1
  delegate_id:       926dfe23b40ae854daba28f23d56bece67c8bd48ef3bc9e3bd592a70725ecaf0
  rewards:           0.0000923483
  penalty:           0
  interests:         0.0781894 (payed)
  pending_interests: 0.2087166 (not payed yet, can be given by 'sp-pay-interests' command)
  going to unlock at: <not going>
- id:                cc8f6aae01b0e6d4ae0fa554e1a72de6afaf88c27a87b3e54230557b4cbf630b
  balance:           1
  delegate_id:       aafb80d9dfd3c829bf809b04d5c9beace6d0a1e9565bb4c816742a877fcda110
  rewards:           0.00002933
  penalty:           0
  interests:         0.0652636 (payed)
  pending_interests: 0.2087166 (not payed yet, can be given by 'sp-pay-interests' command)
  going to unlock at: <not going>
penalty:   0 (total blobber penalty for all time)
rewards:
  charge:   0.0001904301 (for all time)
  blobber:   0.0004464725 (for all time)
  validator: 0.0000021423 (for all time)
settings:
  delegate_wallet: 7875e1cce7e8aa4397d8e1251f95cf97c8c7495fca7c793777b310a4d6a66eda
  min_stake:       1
  max_stake:       100
  num_delegates:   50
​
```

To Unlock tokens from stake pool again you can use the `sp-unlock` command.

```
./zbox sp-unlock --blobber_id 011a5444c9fe53137da7c3d871f3bf4bbf3c01607b14aa95ff2de43b5537d4b6 --pool_id b1e5f86af8b39d6486f69c03a078b3b6ae3129557a0fbc18cbb73967cbf6c206
​
```

#### Cause 3: Your allocation has expired

Every allocation created using `./zbox newallocation` command has an expire time .By default it is (720h0m0s) but you can specify a particular duration using an `--expire`flag as well. To know the expiration of the allocation use `./zbox listallocations`

Sample Response:

```
ID   |    SIZE    |          EXPIRATION           | DATASHARDS | PARITYSHARDS | FINALIZED | CANCELED |  
R  PRICE   |   W  PRICE
+------------------------------------------------------------------+------------+---------------------------
  6c2b94419c2b94b4dd4afc4d41f25509a33bd32c6150114edaf016f54e866eb0 | 2147483648 | 2021-05-06 21:10:03 +0000 UTC |          2 |            2 | false     | false    | 0.0437769963 |  0.026888
```

If your allocation has expired you can finalize an expired allocation to get the unused tokens back. The command for finalizing the allocation is :

```
  ./zbox alloc-fini --allocation $ALLOC
```

### Error 2: Error in file operation: File content didn't match with uploaded file

#### Cause1: You didn’t lock any read tokens.

Read Tokens are required and has to be locked in a read pool to perform Zbox operations on dStorage.

If unable to download files from dstorage as shown below

Command:

```
./zbox download --localpath ~/downloads/ --remotepath /myfiles/info.txt --allocation $ALLOC
​
```

Response:

```
Error in file operation: File content didn't match with uploaded file
```

You must check whether you have read tokens created. Through zbox, it can be done using the `rp-info` and `rp-create` command.

If running `./zbox rp-info` shows a below response:

```
no tokens locked
```

You have to lock some tokens using `rp-lock` and command .Flags for the command can be viewed using \`

`./zbox rp-lock --help`

```
Flags:
      --allocation string   allocation id to lock for, required
      --blobber string      blobber id to lock for, optional
      --duration duration   lock duration, required
      --fee float           transaction fee, default 0
  -h, --help                help for rp-lock
      --tokens float        lock tokens number, required
​
```

Sample Command:

```
./zbox rp-lock --allocation $ALLOC --duration 2h --tokens 0.2
```

Try executing Zbox operations again after locking read pools.

#### Cause 2:Your read tokens might have expired

There can be many instances where you are not able to perform Zbox operations on dStorage due to expired read pool for the allocation. Allocations are associated with a read pool which is locked using `./zbox rp-lock`command for a certain duration as shown above. To check the read pool details for a particular allocation , the command is

```
./zbox rp-info --allocation $ALLOC
```

Response:

```
- id:             b5806cb3a47c31f3f5f48329a5ded54fe1eba2b24b19bfca2909bb80ad2a3bb7
  balance:        0.2
  expire_at:      2021-05-06 21:40:49 +0000 UTC
  allocation_id:  6c2b94419c2b94b4dd4afc4d41f25509a33bd32c6150114edaf016f54e866eb0
  locked:         true
  blobbers:
  - blobber_id:  090dc72b647638509a02185dcc2ac031ee35117e27cd2e332e38d8445edc740d
  - balance:     0.0519160164
  - blobber_id:  3b0551d5ecea77e9c9ed77c72eb114b2345fface766ef2ac5883096e160f64d7
  - balance:     0.0519160164
  - blobber_id:  76be262c6113a3b4656c6ecf5ed6bccff3fb2d7a1952891296ccc03be87a243e
  - balance:     0.0456860947
  - blobber_id:  b94cb2f4a689d1af305550a9ee69fc561ad49e699fe265fca4dc0a6a4b66a458
  - balance:     0.0504818723
​
```

Here you will be able to see the pool\_id,allocations ,expiry date,locked tokens and blobbers associated with the pool.

To Unlock tokens from the expired read pool mark the pool id to the variable using:

```
export poolid=b5806cb3a47c31f3f5f48329a5ded54fe1eba2b24b19bfca2909bb80ad2a3bb7
```

then use the `rp-unlock` command.

```
./zbox rp-unlock --pool_id poolid
```

### Error 3:Not able to use read pool `rp-info` and `rp-lock` commands

```
./zbox rp-info
Failed to get read pool info: error requesting read pool info: consensus_failed: consensus failed on sharders
```

This can happen if read pool is not yet created for wallet. Read pool is usually created when new wallet is created by `zbox` or `zwallet`. However, if wallet is created through `zwallet recoverwallet`, read pool may not have been created. Simply run `zbox rp-create.`
