{"record":{"id":"aab127eb3891dbec","repo":"ory/kratos","slug":"received-unexpected-message-template-type-s","errorCode":null,"errorMessage":"received unexpected message template type: %s","messagePattern":"received unexpected message template type: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"courier/email_templates.go","lineNumber":118,"sourceCode":"\t\tvar t email.RegistrationCodeValidModel\n\t\tif err := json.Unmarshal(msg.TemplateData, &t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn email.NewRegistrationCodeValid(d, &t), nil\n\tcase template.TypeVerifiableAddressChanged:\n\t\tvar t email.VerifiableAddressChangedModel\n\t\tif err := json.Unmarshal(msg.TemplateData, &t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn email.NewVerifiableAddressChanged(d, &t), nil\n\tcase template.TypeAuthenticatorKeyAdded:\n\t\tvar t email.AuthenticatorKeyAddedModel\n\t\tif err := json.Unmarshal(msg.TemplateData, &t); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn email.NewAuthenticatorKeyAdded(d, &t), nil\n\tdefault:\n\t\treturn nil, errors.Errorf(\"received unexpected message template type: %s\", msg.TemplateType)\n\t}\n}\n","sourceCodeStart":100,"sourceCodeEnd":121,"githubUrl":"https://github.com/ory/kratos/blob/b86338da04a040247a07f46100a86dcfb3875909/courier/email_templates.go#L100-L121","documentation":"NewEmailTemplateFromMessage switched over the message's template type and fell through every known case into the default branch. The stored TemplateType string does not match any email template the running courier binary knows about, typically because the message was written by a newer/older kratos version than the courier processing it.","triggerScenarios":"Thrown at courier/email_templates.go:118 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Upgrade the kratos and courier components to matching versions so template types align","Inspect the queued message's template_type value to identify the mismatch","Drain or delete stale queued messages produced by the incompatible version"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b86338da04a040247a07f46100a86dcfb3875909","analyzedAt":"2026-09-07T15:58:15.934Z","contentChangedAt":"2026-09-07T15:58:15.934Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}