temporalio/temporal · error
panic(err)
Error message
panic(err)
What it means
fakedata.go's package init configures the go-faker library once for the whole test process: it enables ignoring interface{} fields and caps random map/slice size. If either configuration call returns an error, the init function panics with panic(err), meaning the test binary cannot even start because faker's global config failed.
Source
Thrown at common/testing/fakedata/fakedata.go:18
// Package fakedata provides utilities for generating random data for testing. We recently migrated from gofakeit to
// go-faker. This was to avoid the problem described here: https://github.com/brianvoe/gofakeit/issues/281#issue-2071796056.
// To make such migrations easier in the future, and to ensure that we use [faker.SetIgnoreInterface] before any
// invocation, we created this package.
package fakedata
import (
"github.com/go-faker/faker/v4"
)
func init() {
// We need this option to prevent faker.FakeData from returning an error for any struct that has an interface{} field.
faker.SetIgnoreInterface(true)
// We need this option to prevent faker from taking a long time while generating random data for structs that have
// map or slice fields. This is especially relevant for persistence.ShardInfo, which takes about 1s without this
// option, but only ~100µs with it.
if err := faker.SetRandomMapAndSliceMaxSize(2); err != nil {
panic(err)
}
}
// FakeStruct generates random data for the given struct pointer. Example usage:
//
// var shardInfo persistencespb.ShardInfo
// _ = fakedata.FakeStruct(&shardInfo)
func FakeStruct(a any) error {
return faker.FakeData(a)
}
View on GitHub (pinned to bde624efd1)
Solutions
- Check the go-faker version in go.mod and confirm SetRandomMapAndSliceMaxSize/SetIgnoreInterface exist with the expected signatures; run `go mod tidy` and rebuild.
- Upgrade or pin go-faker to the version compatible with temporal's fakedata package.
- Inspect the underlying err value (change the panic to log it) to see the exact faker configuration failure.
Example fix
// before
if err := faker.SetRandomMapAndSliceMaxSize(2); err != nil {
panic(err)
}
// after
if err := faker.SetRandomMapAndSliceMaxSize(2); err != nil {
logger.Fatal("failed to configure faker", "error", err) // or investigate the error
} Defensive patterns
Strategy: validation
Validate before calling
if err := faker.SetRandomMapAndSliceMaxSize(2); err != nil {
t.Fatalf("faker config failed: %v", err)
} Prevention
- Pin the go-faker version in go.mod and review its API when upgrading.
- Keep fakedata config in one package init and add a smoke test that imports it.
When it happens
Trigger: Running any test binary importing common/testing/fakedata where faker.SetRandomMapAndSliceMaxSize(2) or faker.SetIgnoreInterface(true) returns an error — e.g. an upstream faker version change that altered these APIs' signatures/behavior.
Common situations: Upgrading go-faker to a version where SetRandomMapAndSliceMaxSize validates its argument or returns an error under new conditions; vendoring conflicts causing an unexpected faker implementation to be linked.
Related errors
- Elasticsearch processor is nil
- len(expectedHistoryEvents) != len(actualHistoryEvents)
- panic(err)
- missing RespondWorkflowTaskCompletedRequest return
- history is nil
AI-assisted analysis of temporalio/temporal@bde624efd1 (2026-09-01).
Data as JSON: /api/errors/d130b5a93cdc0e91.
Report an issue: GitHub.