vitessio/vitess · warning

watch terminated with no error

Error message

watch terminated with no error

What it means

oneWatch watches a topology path for custom query-rule changes and only returns when a watch error occurs; if the watch loop exits without producing an error (topo session closed cleanly without an explicit error), this sentinel error is returned to signal the watch terminated abnormally without a cause.

Source

Thrown at go/vt/vttablet/customrule/topocustomrule/topocustomrule.go:198

	for wd := range wdChannel {
		if wd.Err != nil {
			// Last error value, we're done.
			// wdChannel will be closed right after
			// this, no need to do anything.
			return wd.Err
		}

		if err := cr.apply(wd); err != nil {
			// Cancel the watch, drain channel.
			cancel()
			for range wdChannel {
			}
			return err
		}
	}

	return errors.New("watch terminated with no error")
}

// activateTopoCustomRules activates topo dynamic custom rule mechanism.
func activateTopoCustomRules(qsc tabletserver.Controller) {
	if rulePath != "" {
		qsc.RegisterQueryRuleSource(topoCustomRuleSource)

		cr, err := newTopoCustomRule(qsc, ruleCell, rulePath)
		if err != nil {
			log.Error(fmt.Sprintf("cannot start TopoCustomRule: %v", err))
			os.Exit(1)
		}
		cr.start()

		servenv.OnTerm(cr.stop)
	}
}

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Check topo server health/logs around the time of termination
  2. The caller typically retries the watch; if it recurs, investigate topo stability
  3. If seen at shutdown, it is benign — the watch was torn down
Defensive patterns

Strategy: retry

Try / catch

if err := watchRules(); err != nil {
    if strings.Contains(err.Error(), "watch terminated with no error") && !shuttingDown {
        time.Sleep(retryInterval)
        go watchRules() // re-establish the watch
    }
}

Prevention

When it happens

Trigger: The topo watch channel closes (watcher goroutine exits) without delivering a terminal error — e.g. topo session teardown or the watch implementation stopping silently — causing the for-range over wdChannel to end and the function to fall through to the sentinel error.

Common situations: Etcd/ZK topology restarts closing watches; topo client session expiry handled without a specific error; shutdown of vttablet while the rule watcher is active.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/9c267d86b1fe45e3. Report an issue: GitHub.