FyroxEngine/Fyrox · warning

Build was cancelled.

Error message

Build was cancelled.

What it means

During export, build_package spawns a build process and polls a cancellation flag on a loop reading the build's stderr. If the flag is set, the child process is killed and the function returns Ok(()) with this warning. It is not an error — it is the normal (graceful) cancellation path of an in-progress build.

Solutions

  1. Treat this as expected cancellation: check the cancel flag path and just proceed/retry when needed.
  2. If the build should never be cancelled, audit who sets the AtomicBool cancel flag (UI cancel button, shutdown hooks) and remove or guard those writers.
  3. Rerun the export when cancellation was accidental; no state is corrupted because the child process was killed via handle.kill().
  4. Make cancellation explicit in your UI/log so users know a build was aborted rather than failed.

Example fix

// before
let cancel_flag = Arc::new(AtomicBool::new(false));
// accidental: some handler sets it on any UI event
ui.on(Event::Any).execute(move |_| { flag.store(true, Ordering::Relaxed); true });
// after
let cancel_flag = Arc::new(AtomicBool::new(false));
// only set on explicit Cancel button click
ui.on(ButtonMessage::Click).for_widget(cancel_btn).execute(move |_| { flag.store(true, Ordering::Relaxed); true });
Defensive patterns

Strategy: try-catch

Validate before calling

// check before starting a build
if cancel_flag.load(Ordering::Relaxed) {
    return; // don't start a build that will be cancelled
}

Try / catch

// cancellation is reported via Ok(()) + log, not an error
build_package(...)?; // returns Ok on cancel
if cancel_flag.load(Ordering::Relaxed) {
    log::info!("Build was cancelled; skipping post-build steps");
}

Prevention

When it happens

Trigger: Another thread/task sets the shared cancel_flag (e.g. user pressed Cancel in the editor) while build_package is streaming stderr from the running cargo/build process.

Common situations: User cancels a long-running export/build in the Fyrox editor; build takes too long and the user aborts; app shutdown cancels in-flight build tasks.

Related errors


AI-assisted analysis of FyroxEngine/Fyrox@76c91aad8e (2026-09-10). Data as JSON: /api/errors/8522387b9c24aa22. Report an issue: GitHub.

Appendix: source

Thrown at fyrox-build-tools/src/export/mod.rs:117

        TargetPlatform::Android => {
            android::build_package(package_name, build_target, enable_optimization)
        }
    };

    let mut handle = match process.spawn() {
        Ok(handle) => handle,
        Err(err) => {
            return Err(format!("Failed to build the game. Reason: {err:?}"));
        }
    };

    let mut stderr = handle.stderr.take().unwrap();

    // Spin until the build is finished.
    loop {
        if cancel_flag.load(Ordering::Relaxed) {
            Log::verify(handle.kill());
            Log::warn("Build was cancelled.");
            return Ok(());
        }

        for line in BufReader::new(&mut stderr).lines().take(10).flatten() {
            Log::writeln(MessageKind::Information, line);
        }

        match handle.try_wait() {
            Ok(status) => {
                if let Some(status) = status {
                    let code = status.code().unwrap_or(1);
                    if code != 0 {
                        return Err("Failed to build the game.".to_string());
                    } else {
                        Log::info("The game was built successfully.");
                        break;
                    }
                }

View on GitHub (pinned to 76c91aad8e)