{"record":{"id":"5f711a32b24eae61","repo":"caddyserver/caddy","slug":"getting-events-app-v","errorCode":null,"errorMessage":"getting events app: %v","messagePattern":"getting events app: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"modules/caddyhttp/app.go","lineNumber":202,"sourceCode":"\t}\n}\n\n// Provision sets up the app.\nfunc (app *App) Provision(ctx caddy.Context) error {\n\t// store some references\n\tapp.logger = ctx.Logger()\n\tapp.ctx = ctx\n\n\t// provision TLS and events apps\n\ttlsAppIface, err := ctx.App(\"tls\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting tls app: %v\", err)\n\t}\n\tapp.tlsApp = tlsAppIface.(*caddytls.TLS)\n\n\teventsAppIface, err := ctx.App(\"events\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting events app: %v\", err)\n\t}\n\n\trepl := caddy.NewReplacer()\n\n\t// this provisions the matchers for each route,\n\t// and prepares auto HTTP->HTTPS redirects, and\n\t// is required before we provision each server\n\terr = app.automaticHTTPSPhase1(ctx, repl)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif app.Metrics != nil {\n\t\tapp.Metrics.init = sync.Once{}\n\t\tapp.Metrics.httpMetrics = &httpMetrics{}\n\t\t// Scan config for allowed hosts to prevent cardinality explosion\n\t\tapp.Metrics.scanConfigForHosts(app)\n\t\tif err := app.Metrics.provisionOTLP(ctx); err != nil {","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/caddyserver/caddy/blob/50e54ee279aa1e504fe218ca49ab6ae16c100410/modules/caddyhttp/app.go#L184-L220","documentation":"After loading the tls app, the http app loads the events app via ctx.App(\"events\"); any failure provisioning the events app (bad subscriptions, invalid event handler modules) is wrapped as 'getting events app'. The http app depends on events for its event hooks.","triggerScenarios":"A config with an invalid events app section (bad handler module, empty handlers, malformed subscription) loaded indirectly while the http app provisions.","commonSituations":"Same root causes as caddyevents errors 313/314, but surfacing through the http app; typical when the events block was added for webhooks/exec handlers and the plugin is missing or misconfigured.","solutions":["Read the nested error after the colon — it identifies the events-side failure.","Fix the events subscription/handler config (see errors 313/314 remedies).","Remove or comment out the events block to confirm the rest of the config starts.","Validate the whole config with 'caddy validate' to get the direct error."],"exampleFix":"// before (caddyfile)\n{\n    events {\n        on http server_shutdown {\n            handler nope\n        }\n    }\n}\n\n// after\n{\n    events {\n        on http server_shutdown {\n            handler exec {\n                command /usr/bin/logger shutdown\n            }\n        }\n    }\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := caddy.Validate(cfg); err != nil {\n    if strings.Contains(err.Error(), \"getting events app\") {\n        // root cause is the nested events error — fix the events block, not http\n    }\n    return err\n}","preventionTips":["Treat 'getting events app' as a pointer to the events section, never to http.","Validate events blocks standalone after every edit.","Keep event handler plugins pinned in the build."],"tags":["events","http","provisioning","dependencies"],"backgroundTag":null,"analyzedSha":"50e54ee279aa1e504fe218ca49ab6ae16c100410","analyzedAt":"2026-08-15T09:20:21.641Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}