{"record":{"id":"8e0fc1faeac54750","repo":"temporalio/temporal","slug":"can-t-deep-copy-value-of-type-s-v","errorCode":null,"errorMessage":"Can't deep copy value of type %s: %v","messagePattern":"Can't deep copy value of type (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/dynamicconfig/deepcopy.go","lineNumber":76,"sourceCode":"\t\t\t\treturn reflect.ValueOf(time.Time{})\n\t\t\t}\n\t\t\t// nolint:forbidigo // this will be triggered from a static initializer before it can be triggered from production code\n\t\t\tpanic(fmt.Sprintf(\"Can't deep copy non-zero time.Time: %v\", v.Interface()))\n\t\t}\n\t\tnv := reflect.New(v.Type()).Elem()\n\t\tfor i := range v.Type().NumField() {\n\t\t\tnv.Field(i).Set(deepCopyValue(v.Field(i)))\n\t\t}\n\t\treturn nv\n\tcase reflect.Interface, reflect.Func, reflect.Chan:\n\t\t// only nil values of any other reference types allowed!\n\t\tif v.IsNil() {\n\t\t\treturn v\n\t\t}\n\t\tfallthrough\n\tdefault:\n\t\t// nolint:forbidigo // this will be triggered from a static initializer before it can be triggered from production code\n\t\tpanic(fmt.Sprintf(\"Can't deep copy value of type %s: %v\", v.Type(), v))\n\t}\n}\n","sourceCodeStart":58,"sourceCodeEnd":79,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/dynamicconfig/deepcopy.go#L58-L79","documentation":"deepCopyValue handles only the concrete kinds the dynamicconfig default-copy supports (structs, maps, slices, pointers to those, basic scalars). Any other value — e.g. a func, chan, or unhandled composite — reaches the default branch and panics. Like error 613, it fires from static initializers when a setting default contains an unsupported type.","triggerScenarios":"Declaring a dynamicconfig setting whose default value contains a field/value of an unsupported type (func, chan, interface holding something exotic, unsafe pointer) which deepCopyValue recursively encounters.","commonSituations":"Adding a callback field to a config struct default; nesting a map with non-copyable values; upgrading a setting's struct with a new field of an unhandled type.","solutions":["Remove or retype the unsupported field in the setting's default value","Add a case in deepCopyValue for the needed reflect.Kind if genuinely required","Flatten the default struct so it only contains scalars, strings, slices, maps, and nested structs"],"exampleFix":"// before\nSetting{Callback: func() {}}\n// after\nSetting{} // handle callbacks outside the config default value","handlingStrategy":"validation","validationCode":"// reject chan/func/unsafe kinds in defaults","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Restrict default structs to plain data types"],"tags":["go","panic","reflection","dynamicconfig","deep-copy"],"backgroundTag":"unsupported-deep-copy-type","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}