Skip to content

fix

The fix command is a one-stop repair tool that diagnoses and fixes common issues with NextDNS Blocker. It reinstalls the scheduler, runs a sync, and verifies shell completion.

Terminal window
nextdns-blocker fix

The fix command runs through 5 repair steps:

Verifies that:

  • .env file exists and is readable
  • Required variables are present
  • Configuration is valid

If this fails, you need to run nextdns-blocker init first.

Identifies how NextDNS Blocker was installed:

  • module: Running as Python module (python -m nextdns_blocker)
  • pipx: Installed via pipx
  • system: Installed via Homebrew or system pip

This determines how to invoke commands for repair.

Removes and reinstalls the watchdog scheduler:

  • macOS: Unloads and reloads launchd agents
  • Linux: Removes and recreates cron jobs
  • Windows: Deletes and recreates Task Scheduler tasks

This fixes issues where:

  • Scheduler was corrupted
  • System update broke scheduled tasks
  • Scheduler was accidentally removed

Executes a full sync to:

  • Apply current configuration
  • Update NextDNS denylist
  • Process any pending actions

This ensures the system is in a consistent state.

Verifies and installs shell completion:

  • Detects current shell (bash, zsh, fish)
  • Checks if completion is installed
  • Installs if missing (non-Windows only)
Terminal window
nextdns-blocker fix

Output:

NextDNS Blocker Fix
-------------------
[1/5] Checking configuration...
Config: OK
[2/5] Detecting installation...
Type: pipx
[3/5] Reinstalling scheduler...
Scheduler: OK
[4/5] Running sync...
Sync: OK
[5/5] Checking shell completion...
Completion: OK
Fix complete!

Run fix when:

  • Sync stops working - Scheduler may be broken
  • After OS update - System tasks may need reinstalling
  • After package upgrade - Paths may have changed
  • Watchdog not running - Quick way to reinstall
  • Something feels wrong - General repair tool
CodeMeaning
0All repairs successful
1Configuration error (run init first)
1Scheduler installation failed
CommandPurpose
healthDiagnose issues (read-only)
fixRepair issues (makes changes)
initInitial setup
watchdog installInstall scheduler only
[1/5] Checking configuration...
Config: FAILED - Missing .env file

Solution: Run nextdns-blocker init to set up configuration.

[3/5] Reinstalling scheduler...
Scheduler: FAILED - Permission denied

Solutions:

  • Check you have permission to create scheduled tasks
  • On macOS: May need to allow in System Preferences > Security
  • On Linux: Check crontab access
[4/5] Running sync...
Sync: FAILED - API error

Solutions:

  • Check internet connection
  • Verify API credentials with nextdns-blocker health
  • Check NextDNS service status
[4/5] Running sync...
Sync: TIMEOUT

Solutions:

  • Check internet connection stability
  • Increase API timeout in .env: API_TIMEOUT=30

Use in maintenance scripts:

#!/bin/bash
# Weekly maintenance
nextdns-blocker fix && echo "Maintenance complete"

The fix command does not:

  • Modify your config.json (domain configuration)
  • Change your .env settings
  • Update the package itself (use update for that)
  • Clear logs or data files

For complete removal and fresh start, use nextdns-blocker uninstall.