nats-io/nats-server · error

field %q: old=%v, new=%v

Error message

field %q: old=%v, new=%v

What it means

Generic reflect-based field differ (used for options structs that must be immutable across reloads): it walks exported, non-ignored fields with reflect.DeepEqual and reports the first field whose old and new values differ, including field name and both values. The specific field at fault is named in the error; the field is one that has no dedicated reload handler.

Source

Thrown at server/reload.go:2877

		if field.PkgPath != _EMPTY_ {
			continue
		}
		// If it is in the set of fields to ignore, move to the next.
		// We expect the number of ignore fields to be small.
		var ignored bool
		for _, f := range ignoreFields {
			if f == field.Name {
				ignored = true
				break
			}
		}
		if ignored {
			continue
		}
		oldValue := oldConfig.Field(i).Interface()
		newValue := newConfig.Field(i).Interface()
		if !reflect.DeepEqual(oldValue, newValue) {
			return fmt.Errorf("field %q: old=%v, new=%v", field.Name, oldValue, newValue)
		}
	}
	return nil
}

View on GitHub (pinned to 3a66a489d2)

Solutions

  1. Identify the named field in the error, revert it to its current runtime value, and reload again
  2. If the change is required, restart the server instead of reloading
  3. Consult documentation for which options of that struct support dynamic reload
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at server/reload.go:2877 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of nats-io/nats-server@3a66a489d2 (2026-09-02). Data as JSON: /api/errors/bdb27d832878c4ce. Report an issue: GitHub.