DioxusLabs/dioxus · error · anyhow::Error

signtool.exe failed with exit code

Error message

signtool.exe failed with exit code: {:?}

What it means

Raised in run_signtool_sign (invoked from try_sign_windows) after invoking signtool.exe with the assembled signing arguments (certificate, timestamp URL, target path): the tool ran but exited with a non-success status. This is an external tool failure from the Windows SDK signer — common causes are an invalid/expired certificate or bad signtool arguments — distinct from the earlier 'Failed to run signtool.exe' error which fires when the binary cannot be spawned at all.

Solutions

  1. signtool.exe failed. Ensure the certificate is installed and the signtool arguments are valid.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at packages/cli/src/bundler/windows.rs:903 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of DioxusLabs/dioxus@24f6a829df (2026-08-23). Data as JSON: /api/errors/9b8676f1b0f1d42b. Report an issue: GitHub.

Appendix: source

Thrown at packages/cli/src/bundler/windows.rs:903

            );
        } else {
            args.push("/t".to_string());
            args.push(timestamp_url.clone());
        }
    }

    args.push(path.to_string_lossy().to_string());

    tracing::debug!("Running signtool with args: {:?}", args);

    let status = Command::new("signtool.exe")
        .args(&args)
        .status()
        .await
        .context("Failed to run signtool.exe. Is the Windows SDK installed?")?;

    if !status.success() {
        bail!("signtool.exe failed with exit code: {:?}", status.code());
    }

    Ok(())
}

/// Render a Handlebars template with the given data.
///
/// Handlebars treats `\{{` as an escape sequence that outputs a literal `{{`.
/// This is a problem for Windows paths like `$INSTDIR\{{product_name}}` where
/// the backslash is a path separator, not an escape. We work around this by
/// replacing `\{{` with a placeholder before Handlebars parses the template,
/// then restoring the backslash in the rendered output.
fn render_template(template: &str, data: &BTreeMap<String, JsonValue>) -> Result<String> {
    const BACKSLASH_PLACEHOLDER: &str = "\x00BSEP\x00";
    let replacement = String::from(BACKSLASH_PLACEHOLDER) + "{{";
    let safe_template = template.replace("\\{{", &replacement);
    let mut hbs = Handlebars::new();
    hbs.set_strict_mode(false);

View on GitHub (pinned to 24f6a829df)