stretchr/testify · error
Reset() is deprecated
Error message
Reset() is deprecated
What it means
CollectT.Reset() (assert/assertions.go:2065) is an unconditionally panicking stub marked Deprecated. It was an internal helper that was accidentally exported and later removed; calling it always panics with this message. CollectT is the error-collecting TestingT used by EventuallyWithT.
Source
Thrown at assert/assertions.go:2066
}
// Helper is like [testing.T.Helper] but does nothing.
func (CollectT) Helper() {}
// Errorf collects the error.
func (c *CollectT) Errorf(format string, args ...interface{}) {
c.errors = append(c.errors, fmt.Errorf(format, args...))
}
// FailNow stops execution by calling runtime.Goexit.
func (c *CollectT) FailNow() {
c.fail()
runtime.Goexit()
}
// Deprecated: That was a method for internal usage that should not have been published. Now just panics.
func (*CollectT) Reset() {
panic("Reset() is deprecated")
}
// Deprecated: That was a method for internal usage that should not have been published. Now just panics.
func (*CollectT) Copy(TestingT) {
panic("Copy() is deprecated")
}
func (c *CollectT) fail() {
if !c.failed() {
c.errors = []error{} // Make it non-nil to mark a failure.
}
}
func (c *CollectT) failed() bool {
return c.errors != nil
}
// EventuallyWithT asserts that given condition will be met in waitFor time,View on GitHub (pinned to 001eb7946b)
Solutions
- Remove the Reset() call — CollectT is meant to be used once per EventuallyWithT run, not reset.
- If you need a fresh error collector, allocate a new CollectT instead of resetting an existing one.
- Search the codebase for '.Reset()' on CollectT values and delete those lines.
Example fix
// before
collectT := &assert.CollectT{}
assert.EventuallyWithT(collectT, func(*assert.CollectT) bool { ... }, ...)
collectT.Reset()
// after
collectT := &assert.CollectT{}
assert.EventuallyWithT(collectT, func(*assert.CollectT) bool { ... }, ...) Defensive patterns
Strategy: validation
Validate before calling
// Static prevention: search & remove collectT.Reset() calls. // No runtime guard is meaningful — Reset() always panics.
Try / catch
// There is no recovery pattern; the method is intentionally gone. // Delete all .Reset() calls on *assert.CollectT values.
Prevention
- After upgrading testify, grep for '.Reset()' on CollectT and remove.
- Pin to the changelog entry that deprecated Reset.
- Allocate a fresh CollectT per run instead of reusing/resetting.
When it happens
Trigger: Calling collectT.Reset() on a *assert.CollectT instance — typically copy-pasted from old testify examples or a pre-1.8 codebase that used Reset to clear collected errors between iterations.
Common situations: Upgrading testify past the version where Reset was deprecated; following an outdated tutorial or Stack Overflow answer; generated test scaffolding that still calls Reset.
Related errors
- Copy() is deprecated
- test failed and t is missing `FailNow()`
- cannot use Func in expectations. Use mock.AnythingOfType("%T
- not before calls must be created with Mock.On()
- assert: arguments: %s is not a func
AI-assisted analysis of stretchr/testify@001eb7946b (2026-08-04).
Data as JSON: /data/errors/174f713365f24bc6.json.
Report an issue: GitHub.