HelloZeroNet / HelloZeroNet/ZeroNet

UnboundLocalError: local variable 'err' referenced before assignment

Open
#2,824 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
18.8k
Forks
2.3k
PR merge metrics
No merged PRs in 30d

Description

### Step 1: Please describe your environment

* ZeroNet version: 0.7.2 r4555
* Operating system: Devuan Chimaera 4.0
* Web browser: Firefox ESC
* Tor status: enabled/available
* Opened port: yes
* Special configuration: `$ cat zeronet.conf
[global]
open_browser = False
threads_crypt = 3
threads_fs_write = 2
threads_fs_read = 4
language = en
fileserver_ip_type = ipv4`

### Step 2: Describe the problem: While running `siteVerify` on a large site, I get the said error message:
````
$ python3 ./core/zeronet.py siteVerify 1TaLkFrMwvbNsooF4ioKAY9EuxTBTjipT
- Starting ZeroNet...
PluginManager Plugin Bigfile load error: ModuleNotFoundError: No module named 'merkletools' in PluginManager.py line 138 > Bigfile/__init__.py line 1 > BigfilePlugin.py line 20
PluginManager Plugin CryptMessage load error: ModuleNotFoundError: No module named 'base58' in PluginManager.py line 138 > CryptMessage/__init__.py line 1 > CryptMessagePlugin.py line 7 > CryptBitcoin.py line 14 > lib/sslcrypto/__init__.py line 4 > lib/sslcrypto/openssl/__init__.py line 1 > lib/sslcrypto/openssl/aes.py line 4 > lib/sslcrypto/fallback/__init__.py line 2 > lib/sslcrypto/fallback/ecc.py line 4 > lib/sslcrypto/_ecc.py line 4
- Version: 0.7.2 r4555, Python 3.9.2 (default, Feb 28 2021, 17:03:44)
[GCC 10.2.1 20210110], Gevent: 22.10.2
SiteManager Loading sites... (cleanup: True, startup: False)
SiteManager Added 44 sites in 0.098s
Db#2:ContentDb Loaded 257792 optional files: 1191006.56MB, downloaded: 290.05MB in 0.464s
- Verifing site: 1TaLkFrMwvbNsooF4ioKAY9EuxTBTjipT...
- Verifing content.json signature...
- Unhandled exception: local variable 'err' referenced before assignment
Traceback (most recent call last):
File "/home/quix0r/ZeroNet-linux-dist-linux64/./core/zeronet.py", line 17, in main
main.start()
File "/home/quix0r/ZeroNet-linux-dist-linux64/core/src/main.py", line 602, in start
actions.call(config.action, action_kwargs)
File "/home/quix0r/ZeroNet-linux-dist-linux64/core/src/main.py", line 133, in call
back = func(**kwargs)
File "/home/quix0r/ZeroNet-linux-dist-linux64/core/src/main.py", line 263, in siteVerify
logging.error("[ERROR] %s: invalid file: %s!" % (content_inner_path, err))
UnboundLocalError: local variable 'err' referenced before assignment

````
PS: I had to install missing `gevent` through `pip` before. The version from my distribution is rather old (20.9.0-2 versus 22.10.2) or otherwise a simple `$ python3 ./core/zeronet.py --version` doesn't work.

#### Steps to reproduce:

1. Just execute the above command, or try an other site white ZeroNet is running.

#### Observed Results:

* I got the above error message.

#### Expected Results:

* The command runs through without any error messages.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in core/src/main.py at siteVerify, especially the logging statement on line 263 where the traceback reports the unbound err variable. Run the reported siteVerify command and inspect the surrounding verification path and its error handling. Done means the command no longer raises UnboundLocalError and reports verification failures without crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.