{"record":{"id":"c9f0aebdcde771b3","repo":"temporalio/temporal","slug":"unsupported-error-type-v","errorCode":null,"errorMessage":"unsupported error type: %v","messagePattern":"unsupported error type: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"common/persistence/faultinjection/fault.go","lineNumber":57,"sourceCode":"\t\treturn newFaultFromError(fmt.Errorf(\"%s: %w\", header, context.DeadlineExceeded), errRate)\n\tcase \"Timeout\":\n\t\treturn newFaultFromError(&persistence.TimeoutError{Msg: fmt.Sprintf(\"%s: persistence.TimeoutError\", header)}, errRate)\n\tcase \"ExecuteAndTimeout\":\n\t\t// Special error which emulates case, when caller got a Timeout error,\n\t\t// but operation actually reached persistence and was executed successfully.\n\t\tf := newFaultFromError(&persistence.TimeoutError{Msg: fmt.Sprintf(\"%s: persistence.TimeoutError\", header)}, errRate)\n\t\tf.execOp = true\n\t\treturn f\n\tcase \"ResourceExhausted\":\n\t\treturn newFaultFromError(&serviceerror.ResourceExhausted{\n\t\t\tCause:   enumspb.RESOURCE_EXHAUSTED_CAUSE_SYSTEM_OVERLOADED,\n\t\t\tScope:   enumspb.RESOURCE_EXHAUSTED_SCOPE_SYSTEM,\n\t\t\tMessage: fmt.Sprintf(\"%s: serviceerror.ResourceExhausted\", header),\n\t\t}, errRate)\n\tcase \"Unavailable\":\n\t\treturn newFaultFromError(serviceerror.NewUnavailablef(\"%s: serviceerror.Unavailable\", header), errRate)\n\tdefault:\n\t\tpanic(fmt.Sprintf(\"unsupported error type: %v\", errName))\n\t}\n}\n\nfunc (f *fault) inject(op func() error) error {\n\tif f == nil {\n\t\treturn op()\n\t}\n\tif f.execOp {\n\t\terr := op()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn f.err\n}\n","sourceCodeStart":39,"sourceCodeEnd":73,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/common/persistence/faultinjection/fault.go#L39-L73","documentation":"configuredFaultInjector builds fault objects from dynamic-config fault-injection rules, mapping an error type name (e.g. \"ResourceExhausted\", \"Unavailable\") to a concrete serviceerror constructor. An error name outside the supported set panics, because fault injection config is validated only at use time. This is a configuration-driven panic, so bad dynamic config can crash the calling service.","triggerScenarios":"Setting the fault-injection dynamic config with an error name not in the supported map (typos like \"ResourceExhaustion\", unsupported types like \"InvalidArgument\" if unimplemented, or wrong casing) — newFault is then called with that errName.","commonSituations":"Typos or wrong casing in fault-injection dynamic config values; copying config examples from newer versions supporting more error types; enabling fault injection in production config by mistake.","solutions":["Check the fault-injection dynamic config entry and correct the error name to a supported value (e.g. \"ResourceExhausted\", \"Unavailable\")","Match the exact casing used in the switch statement in common/persistence/faultinjection/fault.go","Validate fault-injection config in a staging environment before applying to production","If you need another error type, add a case to newFault's switch and deploy the change"],"exampleFix":"// before (dynamic config YAML)\nfaultInjection:\n  error: ResourceExhaustion   # typo -> panic\n// after\nfaultInjection:\n  error: ResourceExhausted    # supported name","handlingStrategy":"validation","validationCode":"supported := map[string]bool{\"ResourceExhausted\": true, \"Unavailable\": true}\nif !supported[errName] {\n\treturn fmt.Errorf(\"unsupported fault injection error type: %q\", errName)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate fault-injection dynamic config values before applying them","Use exact supported names/casing from the fault.go switch","Test fault-injection config in staging before production","Never enable fault injection in production clusters"],"tags":["go","fault-injection","dynamicconfig","panic"],"backgroundTag":"unsupported-configuration","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}