AdguardTeam/AdGuardHome · error · errors.ErrUnsupported

service manager can't reload: %w

Error message

service manager can't reload: %w

What it means

Thrown when the user runs the 'reload' service control action but the platform's service manager does not implement the ossvc.ReloadManager interface. The code performs a type assertion on the Manager; on platforms whose manager has no Reload method (or when a mock/unsupported implementation is injected), the assertion fails and the error wraps errors.ErrUnsupported.

Source

Thrown at internal/home/service.go:292

	case ossvc.StatusNotInstalled:
		l.InfoContext(ctx, "not installed")
	case ossvc.StatusStopped:
		l.InfoContext(ctx, "stopped")
	case ossvc.StatusRunning:
		l.InfoContext(ctx, "running")
	case ossvc.StatusRestartOnFail:
		l.InfoContext(ctx, "restarting after failed start")
	}

	return nil
}

// handleServiceReloadCmd reloads the service, if it's running.  l must not be
// nil, mgr must be a ReloadManager.
func handleServiceReloadCmd(ctx context.Context, l *slog.Logger, mgr ossvc.Manager) (err error) {
	relSvcMgr, ok := mgr.(ossvc.ReloadManager)
	if !ok {
		return fmt.Errorf("service manager can't reload: %w", errors.ErrUnsupported)
	}

	err = relSvcMgr.Reload(ctx, serviceName)
	if err != nil {
		return fmt.Errorf("reloading service: %w", err)
	}

	l.InfoContext(ctx, "service reloaded successfully")

	return nil
}

// handleServiceInstallCmd handles the service "install" command.  l must
// not be nil.
func handleServiceInstallCmd(
	ctx context.Context,
	l *slog.Logger,
	mgr ossvc.Manager,

View on GitHub (pinned to b41aefbe51)

Solutions

  1. Use a different action (e.g. 'restart' or 'stop'/'start') which all managers support
  2. If you maintain a custom Manager, implement Reload(ctx, serviceName) error so it satisfies ossvc.ReloadManager
  3. Check errors.Is(err, errors.ErrUnsupported) to detect this case and fall back to restart

Example fix

// before
relSvcMgr, ok := mgr.(ossvc.ReloadManager)
if !ok {
	return fmt.Errorf("service manager can't reload: %w", errors.ErrUnsupported)
}

// after (caller fallback)
err := handleServiceControlAction(ctx, l, mgr, "reload")
if errors.Is(err, errors.ErrUnsupported) {
	err = handleServiceControlAction(ctx, l, mgr, "restart")
}
Defensive patterns

Strategy: fallback

Validate before calling

// before invoking the action
if _, ok := mgr.(ossvc.ReloadManager); !ok {
    // choose restart instead of reload
}

Type guard

func canReload(mgr ossvc.Manager) bool {
    _, ok := mgr.(ossvc.ReloadManager)
    return ok
}

Try / catch

// after
callErr := handleServiceControlAction(ctx, l, mgr, "reload")
if errors.Is(callErr, errors.ErrUnsupported) {
    callErr = handleServiceControlAction(ctx, l, mgr, "restart")
}

Prevention

When it happens

Trigger: Invoking the service command with action=reload on an OS whose ossvc.Manager implementation does not also implement ReloadManager (e.g. a minimal or third-party manager implementation), or unit tests passing a plain Manager mock.

Common situations: Running 'AdGuardHome -s reload' on an OS without a reload-capable service integration; custom builds that swap in their own ossvc.Manager; version changes where ReloadManager was newly required but the implementation wasn't updated.

Related errors


AI-assisted analysis of AdguardTeam/AdGuardHome@b41aefbe51 (2026-08-27). Data as JSON: /api/errors/da731ebb81c04768. Report an issue: GitHub.