Skip to content

Fix/butler debugging#42

Merged
ArchDevs merged 6 commits intomainfrom
fix/butler-debugging
Feb 18, 2026
Merged

Fix/butler debugging#42
ArchDevs merged 6 commits intomainfrom
fix/butler-debugging

Conversation

@ArchDevs
Copy link
Owner

fixed butler applying related bugs

Cause of bugs was that user might create/delete/edit game files that caused butler signature checking fail. Before applying game update we apply signature, if it passes we just upgrade existing files, if not then reinstall game completely

Arch Dev added 6 commits February 18, 2026 13:37
- Fix 'write /dev/stdout: The handle is invalid' error on Windows by not writing to os.Stdout/Stderr directly
- Add --verbose flag to butler apply command for better output
- Add comprehensive debug logging that writes to butler-debug.log on failure
- Add TestButler() diagnostic function to help troubleshoot butler issues
- Log environment variables and butler version before running commands
When users modify game files (add/remove files), butler's signature verification
fails with 'expected X dirs, got Y dirs' error. This fix:

- Detects signature verification failures by checking stderr output
- Automatically cleans the game directory when signature mismatch is detected
- Retries the patch application with a fresh directory
- Provides clear error messages if cleanup or retry fails

This prevents users from being stuck with a broken installation that requires
manual intervention.
The signature verification error message appears in different places depending
on butler version. Now checks both stdout and stderr for signature errors.
Butler keeps resume state in the staging directory. When we clean the game
directory, we also need to clean the staging directory to prevent butler from
trying to resume from a corrupted state.
…handling

- Remove verbose logging of every file in game directory
- Remove butler version check on every patch (not needed)
- Remove environment variable logging
- Simplify debug log format to essential info only
- Keep signature error detection and auto-retry logic
- Keep debug log writing for troubleshooting failures
- Extract handleApplyError for error handling logic
- Extract isSignatureError for signature detection
- Extract retryAfterCleanup for retry logic
- Extract cleanup for resource cleanup
- Extract writeDebugLog for debug file creation
- Remove redundant error logging (errors are returned and logged upstream)
- Simplify DownloadAndApplyPWR by removing verbose logging
@ArchDevs ArchDevs merged commit 50c2a7c into main Feb 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments