EpicGames/lore · error
{e}
Error message
{e} What it means
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.
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).
Example fix
// before
let ctx = builder.build(); // panics if fields missing
// after
let ctx = builder.try_build().context("building HookContext")?; Defensive patterns
Strategy: validation
Validate before calling
builder.correlation_id(id)
.hook_point(hp)
.repository(repo);
// verify all set before build(): use try_build()
let ctx = builder.try_build().map_err(|e| eprintln!("missing: {e}"))?; Try / catch
match builder.try_build() {
Ok(ctx) => ctx,
Err(e) => panic or return Err(e),
} Prevention
- 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().
When it happens
Trigger: Calling HookContextBuilder::build() without first calling .correlation_id(..), .hook_point(..), or .repository(..); only try_build() returns Err, build() panics with the message.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Failed to open log file
- Networking not supported on this OS
- [environment.endpoint] auth_url is set but [server.auth] is…
- Stream handler factory was not set
- Address was not set
AI-assisted analysis of EpicGames/lore@074eb0b0d1 (2026-09-13).
Data as JSON: /api/errors/211cf05d0e28fde3.
Report an issue: GitHub.
Appendix: source
Thrown at lore-server/src/hooks/context.rs:277
/// Sets the revision number.
pub fn revision_number(mut self, revision_number: u64) -> Self {
self.revision_number = Some(revision_number);
self
}
/// Adds a metadata entry.
pub fn metadata(mut self, key: impl Into<String>, value: impl Into<String>) -> Self {
self.metadata.insert(key.into(), value.into());
self
}
/// Builds the [`HookContext`].
///
/// # Panics
///
/// Panics if `correlation_id`, `hook_point`, or `repository` is not set.
pub fn build(self) -> HookContext {
self.try_build().unwrap_or_else(|e| panic!("{e}"))
}
/// Tries to build the [`HookContext`], returning an error if required fields are missing.
///
/// # Errors
///
/// Returns an error string if `correlation_id`, `hook_point`, or `repository` is not set.
pub fn try_build(self) -> Result<HookContext, &'static str> {
let correlation_id = self
.correlation_id
.ok_or("correlation_id is required for HookContext")?;
let hook_point = self
.hook_point
.ok_or("hook_point is required for HookContext")?;
let repository = self
.repository
.ok_or("repository is required for HookContext")?;
View on GitHub (pinned to 074eb0b0d1)