{"record":{"id":"5ae044d221016dbc","repo":"EpicGames/lore","slug":"failed-to-create-hooks-from-configuration","errorCode":null,"errorMessage":"Failed to create hooks from configuration","messagePattern":"Failed to create hooks from configuration","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"lore-server/src/server.rs","lineNumber":1903,"sourceCode":"            &settings.notification,\n            local_store().as_ref(),\n            &settings.plugins,\n        )\n        .await?;\n\n        // Build hook dispatcher: register build.rs-discovered hooks then config-provided hooks\n        let hook_ctx = HookRegistrationContext {\n            notification_sender: notification.clone(),\n        };\n        let mut hook_registry = HookRegistry::new();\n        crate::hooks::register_all_hooks(&mut hook_registry, &hook_ctx);\n        for callback in config.hook_registration_callbacks {\n            callback(&mut hook_registry, &hook_ctx);\n        }\n\n        let enabled_hooks = hook_registry\n            .create_enabled_hooks(&settings.hooks)\n            .expect(\"Failed to create hooks from configuration\");\n\n        let hook_dispatcher = Arc::new(HookDispatcher::from_hooks_default(enabled_hooks));\n\n        lore_spawn!(endpoints, {\n            let immutable_store = immutable_store.clone();\n            let mutable_store = mutable_store.clone();\n            let lock_store = lock_store.clone();\n            let jwt_verifier = jwt_verifier.clone();\n            let repository_authorizer = repository_authorizer.clone();\n            let settings = settings.clone();\n            let notification = notification.clone();\n            let user_agent_filter = user_agent_filter.clone();\n            let forwarded_requests = forwarded_requests.clone();\n            let shutdown_rx = _shutdown_rx.clone();\n\n            let local_immutable_store = local_store().unwrap_or_else(|| {\n                warn!(\"No local store available for gRPC server, operations requiring local store will route to the main store\");\n                immutable_store.clone()","sourceCodeStart":1885,"sourceCodeEnd":1921,"githubUrl":"https://github.com/EpicGames/lore/blob/074eb0b0d1194c997d7cf28b55519e3e197b3e23/lore-server/src/server.rs#L1885-L1921","documentation":"A `.expect(\"Failed to create hooks from configuration\")` panic in the server startup path (`async_main`, invoked from `server_main`) when `hook_registry.create_enabled_hooks(&settings.hooks)` returns Err. This converts an invalid hooks configuration into a hard startup failure: the server refuses to boot rather than run with broken hooks.","triggerScenarios":"`settings.hooks` names a hook type that has no registered factory (registration callbacks didn't register it), or a hook's configuration section fails that hook's own config validation (missing/invalid fields, bad types, bad URLs/paths).","commonSituations":"Typo'd or renamed hook entries in the server config file after a version upgrade; enabling a built-in hook that was removed or moved behind a feature flag; hook config schema changed between versions so old settings no longer validate; a custom hook's registration callback not running before this call.","solutions":["Read the Err returned by create_enabled_hooks (replace expect temporarily or check logs) to see which hook name failed","Fix the `hooks` section of the server settings file — correct hook names and required fields","Confirm the hook's registration callback is registered so a factory exists for every enabled hook","After upgrading, migrate the hooks config to the current schema","Disable the offending hook to boot the server, then fix its configuration"],"exampleFix":"// before\nlet enabled_hooks = hook_registry\n    .create_enabled_hooks(&settings.hooks)\n    .expect(\"Failed to create hooks from configuration\");\n// after\nlet enabled_hooks = hook_registry.create_enabled_hooks(&settings.hooks)\n    .unwrap_or_else(|e| {\n        eprintln!(\"invalid hooks configuration: {e:?}\");\n        std::process::exit(1);\n    });","handlingStrategy":"validation","validationCode":"// Validate hooks config before startup\nfor (name, hook_cfg) in &settings.hooks {\n    if !hook_registry.has_factory(name) {\n        return Err(format!(\"unknown hook '{name}' in configuration\"));\n    }\n    hook_registry.validate_hook_config(name, hook_cfg)?;\n}","typeGuard":null,"tryCatchPattern":"let enabled_hooks = hook_registry.create_enabled_hooks(&settings.hooks)\n    .map_err(|e| format!(\"hook configuration error: {e}\"))?;","preventionTips":["Validate the hooks config section at config-load time, before spawning the server","After upgrades, run the config through the current schema/migration","Keep hook registration callbacks registered before create_enabled_hooks is called"],"tags":["rust","configuration","hooks","startup-failure","panic"],"backgroundTag":"invalid-config-value","analyzedSha":"074eb0b0d1194c997d7cf28b55519e3e197b3e23","analyzedAt":"2026-09-13T09:00:57.509Z","contentChangedAt":"2026-09-13T09:00:57.509Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}