Issues with key file persistence & exit node lookup
- Dominant language
- TypeScript
- Stars
- 22.8k
- Forks
- 783
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 47
Description
### Describe the Bug
After restarting my Unraid server (no config changes for months), Pangolin/Gerbil failed to start. On boot Gerbil logs an error about failing to assign an IP due to an invalid CIDR and fetching the remote config returns a 404 for the gerbil endpoint.
Key log lines:
```swift
INFO: 2025/10/31 06:13:10 Fetching remote config from http://pangolin:3001/api/v1/gerbil/get-config
INFO: 2025/10/31 06:13:10 Created WireGuard interface wg0
FATAL: 2025/10/31 06:13:10 Failed to assign IP address: failed to parse IP address: invalid CIDR address:
```
Manual check of the endpoint:
```swift
curl http://pangolin:3001/api/v1/gerbil/get-config
```
Response:
```swift
{"data":null,"success":false,"error":true,"message":"The requests url is not found - /api/v1/gerbil/get-config","status":404,"stack":null}
```
This happened after a power outage / UPS-triggered shutdown and subsequent server reboot. No configuration, keys, or exit node edits were made by me prior to this failure.
### Environment
- OS Type & Version: Unraid 7.2.0
- Pangolin Version: latest (1.12.1)
- Gerbil Version: latest (1.2.2)
- Traefik Version: latest (3.5.4?)
- Newt Version: not applicable
- Olm Version: not applicable
### To Reproduce
I cannot reliably reproduce this from scratch, but the failure happened under the following conditions:
1. Running Pangolin + Gerbil on Unraid for some time with a single exit node configured.
2. A power outage caused the UPS to signal shutdown and the server to be rebooted.
3. After reboot, Gerbil fails to start with the `invalid CIDR address:` error and the `/api/v1/gerbil/get-config` endpoint returns a 404.
Observed behavior suggests a database state mismatch where the exit node entry and/or sequence cause Gerbil to generate or reference an invalid/empty CIDR.
### Expected Behavior
* Gerbil should either fail gracefully with a clear, actionable error if DB contains inconsistent exit node data, or attempt to recover automatically (e.g., regenerate exit node or correct sequence inconsistencies).
* The `/api/v1/gerbil/get-config` endpoint should return appropriate config (not `404`) when the service is up.
Contributor guide
Assessment
This issue has not been assessed yet.