The program panics when a game in games.txt has multiple active drop campaigns, but one or more of them have already been fully claimed. The Twitch GQL API appears to return null for the claimed campaign (or for the entire game structure), which the retry! macro cannot handle.
Observed panic:
root@DietPi:~/TwitchDropSentryMulti# ./target/release/twitchdrops_miner --debug
[████████████████████████████████████████] 100% (1815/720 min) Initialization...
thread 'tokio-rt-worker' (6849) panicked at src/stream.rs:140:59:
Retry failed after MAX_ATTEMPTS attempts: TwitchError(JsonError(Error("invalid type: null, expected struct GameDrops", line: 0, column: 0)))
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted
Steps to reproduce:
Add the following games to lists/games.txt (in priority order):
Overwatch
Grand Theft Auto V
Hunt: Showdown 1896
Ensure that:
-
Overwatch has two active drop campaigns: one fully claimed (all drops received), the other still in progress (has unclaimed drops).
Grand Theft Auto V has no active drops.
Hunt: Showdown 1896 has at least one active drop.
-
Run the program: ./target/release/twitchdrops_miner
Actual result
The program crashes immediately with the above panic.
Expected result
The program should gracefully handle the situation:
-
Detect that Overwatch has multiple campaigns, but only one has unclaimed drops.
-
→ Remove the fully claimed campaign from the farming list.
-
Start farming Overwatch for the remaining unclaimed drops.
-
After that drop is claimed, check if any other campaigns remain for Overwatch.
→ If none, move to the next game in the priority list.
-
Skip Grand Theft Auto V (no active drops) with a warning.
-
Start farming Hunt: Showdown 1896.
-
After all drops in the list are claimed, the program should not exit. Instead, it should continue running and periodically re-check all games in games.txt for new campaigns (e.g., every 1–5 minutes).
Assumption
The error is likely caused by the program’s inability to handle multiple active campaigns for a single game, especially when one of them is already fully claimed. Twitch API may return null for the completed campaign, leading to a deserialisation failure in stream.rs.
There is currently no built‑in way to verify that the error is specifically caused by a game with already‑claimed drops. However, in testing, only Overwatch with two campaigns triggered the panic — suggesting that the combination of multiple campaigns + claimed drops is the root cause.
Additional considerations
Diagnostic logging: Adding a diagnostic log that shows the raw API response for each campaign would help users and developers identify which game/campaign is causing the issue.
Proposed fixes
-
Replace all retry! macros in src/stream.rs with proper error handling (e.g., match + continue).
-
In main.rs, remove the early exit when no active campaigns are found, so the program stays alive and keeps checking.
-
Filter out fully claimed campaigns when processing timeBasedDrops (check self_drop.isClaimed).
-
Reduce the re‑check interval to 1–5 minutes (configurable via config.json or an environment variable).
Feature request: improved Discord notifications
Currently, Discord updates are time‑based and can be spammy. I propose a more structured approach:
When farming starts for a game, send a single message in Discord stating:
Game name
Number of drops in the campaign (e.g., "2 drops available")
Name Drops1
Name Drops2
Estimated progress (e.g., "Drop 1: 45%")
Update the same message periodically (every configurable minutes, e.g., 5 or 10 minutes) — not by sending a new message, but by editing the existing one.
When a drop is received, mark it as completed (e.g., "✅ Drop 1: Claimed").
When all drops for the current game are claimed, post a new message about switching to the next game in the priority list.
This would make Discord notifications much cleaner, less spammy, and more informative.
Additional context
Running on Raspberry Pi Zero W (ARMv6) with DietPi OS.
Rust 1.97.1, compiled from source.
Performance note: I launched the application on a Raspberry Pi Zero W (ARMv6, 512 MB RAM). Compilation took approximately 4 hours. This is fine for a one‑time setup, but please keep this in mind for users with low‑power devices.
Thank you for considering this! I'm happy to test any patches or provide more details if needed. 🙌
The program panics when a game in games.txt has multiple active drop campaigns, but one or more of them have already been fully claimed. The Twitch GQL API appears to return null for the claimed campaign (or for the entire game structure), which the retry! macro cannot handle.
Observed panic:
Steps to reproduce:
Add the following games to lists/games.txt (in priority order):
Ensure that:
Overwatch has two active drop campaigns: one fully claimed (all drops received), the other still in progress (has unclaimed drops).
Grand Theft Auto V has no active drops.
Hunt: Showdown 1896 has at least one active drop.
Run the program: ./target/release/twitchdrops_miner
Actual result
The program crashes immediately with the above panic.
Expected result
The program should gracefully handle the situation:
Detect that Overwatch has multiple campaigns, but only one has unclaimed drops.
→ Remove the fully claimed campaign from the farming list.
Start farming Overwatch for the remaining unclaimed drops.
After that drop is claimed, check if any other campaigns remain for Overwatch.
→ If none, move to the next game in the priority list.
Skip Grand Theft Auto V (no active drops) with a warning.
Start farming Hunt: Showdown 1896.
After all drops in the list are claimed, the program should not exit. Instead, it should continue running and periodically re-check all games in games.txt for new campaigns (e.g., every 1–5 minutes).
Assumption
The error is likely caused by the program’s inability to handle multiple active campaigns for a single game, especially when one of them is already fully claimed. Twitch API may return null for the completed campaign, leading to a deserialisation failure in stream.rs.
There is currently no built‑in way to verify that the error is specifically caused by a game with already‑claimed drops. However, in testing, only Overwatch with two campaigns triggered the panic — suggesting that the combination of multiple campaigns + claimed drops is the root cause.
Additional considerations
Diagnostic logging: Adding a diagnostic log that shows the raw API response for each campaign would help users and developers identify which game/campaign is causing the issue.
Proposed fixes
Replace all retry! macros in src/stream.rs with proper error handling (e.g., match + continue).
In main.rs, remove the early exit when no active campaigns are found, so the program stays alive and keeps checking.
Filter out fully claimed campaigns when processing timeBasedDrops (check self_drop.isClaimed).
Reduce the re‑check interval to 1–5 minutes (configurable via config.json or an environment variable).
Feature request: improved Discord notifications
Currently, Discord updates are time‑based and can be spammy. I propose a more structured approach:
When farming starts for a game, send a single message in Discord stating:
Game name
Number of drops in the campaign (e.g., "2 drops available")
Name Drops1
Name Drops2
Estimated progress (e.g., "Drop 1: 45%")
Update the same message periodically (every configurable minutes, e.g., 5 or 10 minutes) — not by sending a new message, but by editing the existing one.
When a drop is received, mark it as completed (e.g., "✅ Drop 1: Claimed").
When all drops for the current game are claimed, post a new message about switching to the next game in the priority list.
This would make Discord notifications much cleaner, less spammy, and more informative.
Additional context
Running on Raspberry Pi Zero W (ARMv6) with DietPi OS.
Rust 1.97.1, compiled from source.
Performance note: I launched the application on a Raspberry Pi Zero W (ARMv6, 512 MB RAM). Compilation took approximately 4 hours. This is fine for a one‑time setup, but please keep this in mind for users with low‑power devices.
Thank you for considering this! I'm happy to test any patches or provide more details if needed. 🙌