EpicGames/lore · error

task failed

Error message

task failed

What it means

In `set_file` (lore-revision metadata), per-path `set_file_task` futures run in a bounded JoinSet (max 1000 concurrent). When draining tasks to stay under MAX_TASK_COUNT, `result.internal("task failed")` wraps any task failure — a JoinError from a panicked/aborted task, or the task's own SetError — into a SetError labeled "task failed".

Solutions

  1. Fix the underlying per-path error: it is reported via the `.or()` merge only if it is the first failure — check the Err payload for the real cause
  2. Validate repository state files are readable and not corrupt before bulk set operations
  3. Retry the operation on a smaller batch of paths to isolate the failing path
  4. If caused by a panic in set_file_task, reproduce with a single path and fix the task code

Example fix

// before
failure = failure.or(result.internal("task failed").err());
// after
failure = failure.or(match result {
    Ok(Err(e)) => Some(e),
    Ok(Ok(())) => None,
    Err(join_err) => SetError::internal(format!("metadata task panicked: {join_err}")).err(),
});
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-validate inputs before spawning tasks
assert_eq!(paths.len(), entries.len(), "paths/entries length mismatch");
assert_eq!(entries.iter().sum::<u32>() as usize, keys.len());

Try / catch

match tasks.join_next().await {
    Some(Ok(Ok(()))) => {}
    Some(Ok(Err(e))) => failure = failure.or(Some(e)),
    Some(Err(join_err)) => failure = failure.or(Some(SetError::internal(join_err.to_string()))),
    None => {}
}

Prevention

When it happens

Trigger: While more than 1000 tasks are queued, one of the joined `set_file_task` futures returns Err (e.g. it failed to load/serialize state, write metadata for a path) or its tokio task panicked and was joined as a JoinError.

Common situations: Bulk metadata sets over >1000 paths where one path's state cannot be read/written (corrupt repository, missing state files); a task panicking due to an internal bug; repository storage errors under concurrent load.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of EpicGames/lore@074eb0b0d1 (2026-09-13). Data as JSON: /api/errors/d44cc59fdebbf902. Report an issue: GitHub.

Appendix: source

Thrown at lore-revision/src/metadata/set.rs:437

        lore_spawn!(tasks, {
            async move {
                set_file_task(
                    repository,
                    state,
                    &path,
                    &keys_vec,
                    &values_vec,
                    &formats,
                    events,
                )
                .await
            }
        });

        while tasks.len() > MAX_TASK_COUNT {
            if let Some(result) = tasks.join_next().await {
                failure = failure.or(result.internal("task failed").err());
            }
        }

        if failure.is_some() {
            break;
        }

        offset += count;
    }

    while let Some(result) = tasks.join_next().await {
        failure = failure.or(result.internal("task failed").err());
    }

    if let Some(err) = failure {
        return Err(err.into());
    }

View on GitHub (pinned to 074eb0b0d1)