{"record":{"id":"4161238f7a03554a","repo":"kataras/iris","slug":"appname-is-not-a-registered-application","errorCode":null,"errorMessage":"<appName> is not a registered Application","messagePattern":"<appName> is not a registered Application","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"context/application.go","lineNumber":205,"sourceCode":"\tmu.RLock()\n\n\tfor i := len(registeredApps) - 1; i >= 0; i-- {\n\t\tif app := registeredApps[i]; app != nil && app.String() == appName {\n\t\t\tmu.RUnlock()\n\t\t\treturn app, true\n\t\t}\n\t}\n\n\tmu.RUnlock()\n\treturn nil, false\n}\n\n// MustGetApplication same as `GetApplication` but it\n// panics if \"appName\" is not a registered Application's name.\nfunc MustGetApplication(appName string) Application {\n\tapp, ok := GetApplication(appName)\n\tif !ok || app == nil {\n\t\tpanic(appName + \" is not a registered Application\")\n\t}\n\n\treturn app\n}\n\n// DefaultLogger returns a Logger instance for an Iris module.\n// If the program contains at least one registered Iris Application\n// before this call then it will return a child of that Application's Logger\n// otherwise a fresh child of the `golog.Default` will be returned instead.\n//\n// It should be used when a module has no access to the Application or its Logger.\nfunc DefaultLogger(prefix string) (logger *golog.Logger) {\n\tif app := LastApplication(); app != nil {\n\t\tlogger = app.Logger()\n\t} else {\n\t\tlogger = golog.Default\n\t}\n","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/context/application.go#L187-L223","documentation":"context.MustGetApplication looks up a child Application by name in the Iris application registry and panics if no Application with that name is registered (or the stored value is nil). It is the strict counterpart of GetApplication, which returns ok=false instead.","triggerScenarios":"Calling context.MustGetApplication(\"appName\") where no application was registered under that exact name, e.g. the child app was created with a different name or New was never called with that name before lookup.","commonSituations":"Typos in application names, lookup happening before the child application registration, or refactoring that renamed apps while other code still references the old name.","solutions":["Ensure an application was registered with exactly this name via app.New(iris.Options{Name: ...}) / the children registry before the lookup.","Fix the name string (case-sensitive exact match).","Use the non-panicking GetApplication and handle the ok=false case when the app may legitimately be absent."],"exampleFix":"// before\nsub := context.MustGetApplication(\"admin\") // panics if missing\n// after\nsub, ok := context.GetApplication(\"admin\")\nif !ok { log.Fatal(\"admin app not registered\") }","handlingStrategy":"type-guard","validationCode":"if _, ok := context.GetApplication(appName); !ok {\n  log.Fatalf(\"application %q not registered\", appName)\n}\nsub := context.MustGetApplication(appName)","typeGuard":"func appRegistered(name string) bool {\n  app, ok := context.GetApplication(name)\n  return ok && app != nil\n}","tryCatchPattern":"defer func() {\n  if r := recover(); r != nil {\n    log.Fatalf(\"MustGetApplication: %v\", r)\n  }\n}()","preventionTips":["Register child applications before any MustGetApplication lookup","Centralize app name constants to avoid typos","Prefer GetApplication with ok-check in optional paths"],"tags":["go","panic","application-registry","routing"],"backgroundTag":"application-not-registered","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}