{"record":{"id":"211cf05d0e28fde3","repo":"EpicGames/lore","slug":"e","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lore-server/src/hooks/context.rs","lineNumber":277,"sourceCode":"    /// Sets the revision number.\n    pub fn revision_number(mut self, revision_number: u64) -> Self {\n        self.revision_number = Some(revision_number);\n        self\n    }\n\n    /// Adds a metadata entry.\n    pub fn metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {\n        self.metadata.insert(key.into(), value.into());\n        self\n    }\n\n    /// Builds the [`HookContext`].\n    ///\n    /// # Panics\n    ///\n    /// Panics if `correlation_id`, `hook_point`, or `repository` is not set.\n    pub fn build(self) -> HookContext {\n        self.try_build().unwrap_or_else(|e| panic!(\"{e}\"))\n    }\n\n    /// Tries to build the [`HookContext`], returning an error if required fields are missing.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error string if `correlation_id`, `hook_point`, or `repository` is not set.\n    pub fn try_build(self) -> Result<HookContext, &'static str> {\n        let correlation_id = self\n            .correlation_id\n            .ok_or(\"correlation_id is required for HookContext\")?;\n        let hook_point = self\n            .hook_point\n            .ok_or(\"hook_point is required for HookContext\")?;\n        let repository = self\n            .repository\n            .ok_or(\"repository is required for HookContext\")?;\n","sourceCodeStart":259,"sourceCodeEnd":295,"githubUrl":"https://github.com/EpicGames/lore/blob/074eb0b0d1194c997d7cf28b55519e3e197b3e23/lore-server/src/hooks/context.rs#L259-L295","documentation":"HookContext::build is the infallible wrapper around try_build: it converts the builder's validation error into a panic. The error string is produced when a required field (correlation_id, hook_point, or repository) was never set on the builder. The docs explicitly warn that build panics in this case.","triggerScenarios":"Calling HookContextBuilder::build() without first calling .correlation_id(..), .hook_point(..), or .repository(..); only try_build() returns Err, build() panics with the message.","commonSituations":"Writing a git hook integration where one required builder field is set conditionally and silently skipped; refactors that add a new required field to the builder but not all construction sites.","solutions":["Ensure correlation_id, hook_point, and repository are all set before calling build().","Switch to try_build() and handle the Result instead of panicking.","Log or inspect the returned message — it names the missing required field(s)."],"exampleFix":"// before\nlet ctx = builder.build(); // panics if fields missing\n// after\nlet ctx = builder.try_build().context(\"building HookContext\")?;","handlingStrategy":"validation","validationCode":"builder.correlation_id(id)\n    .hook_point(hp)\n    .repository(repo);\n// verify all set before build(): use try_build()\nlet ctx = builder.try_build().map_err(|e| eprintln!(\"missing: {e}\"))?;","typeGuard":null,"tryCatchPattern":"match builder.try_build() {\n    Ok(ctx) => ctx,\n    Err(e) => panic or return Err(e),\n}","preventionTips":["Prefer try_build() over build() in non-test code.","Construct builders in one place with all fields supplied.","Add a test per builder field that asserts its absence fails try_build()."],"tags":["rust","builder-pattern","panic","validation"],"backgroundTag":"missing-required-argument","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"}