nikivdev/code · error

runtime asset '{}' not found. searched: {}

Error message

runtime asset '{}' not found. searched:
{}

What it means

require_asset_path in src/runtime_assets.rs locates a bundled runtime asset by scanning candidate roots for the sanitized relative path. If the file is absent from every candidate root, it bails listing all searched paths so the user can see exactly where it looked.

Source

Thrown at src/runtime_assets.rs:31

pub fn asset_path(relative: &str) -> Option<PathBuf> {
    let relative = sanitize_relative(relative);
    candidate_roots()
        .into_iter()
        .map(|root| root.join(relative))
        .find(|candidate| candidate.exists())
}

pub fn require_asset_path(relative: &str) -> Result<PathBuf> {
    if let Some(path) = asset_path(relative) {
        return Ok(path);
    }

    let searched = candidate_roots()
        .into_iter()
        .map(|root| root.join(sanitize_relative(relative)).display().to_string())
        .collect::<Vec<_>>();
    bail!(
        "runtime asset '{}' not found. searched:\n{}",
        relative,
        searched
            .iter()
            .map(|path| format!("- {path}"))
            .collect::<Vec<_>>()
            .join("\n")
    );
}

fn sanitize_relative(relative: &str) -> &Path {
    Path::new(relative.trim_start_matches('/'))
}

fn candidate_roots() -> Vec<PathBuf> {
    let mut roots = Vec::new();

    if let Some(root) = env::var_os(FLOW_RUNTIME_ASSETS_ROOT_ENV).map(PathBuf::from) {

View on GitHub (pinned to a747e741ae)

Solutions

  1. Reinstall/repair the application so runtime assets are present
  2. Check the searched paths in the message and verify the asset exists at one of them
  3. Confirm the relative path argument matches the shipped asset name (sanitization may alter it)
  4. Update to a version where the asset still exists

Example fix

// before
let p = require_asset_path("scripts/old-helper.sh")?;  // renamed upstream
// after
let p = require_asset_path("scripts/helper.sh")?;
Defensive patterns

Strategy: fallback

Validate before calling

fn asset_available(relative: &str) -> bool {
    candidate_roots().iter().any(|r| r.join(sanitize_relative(relative)).exists())
}
if !asset_available("scripts/helper.sh") { eprintln!("asset missing; reinstall"); return; }

Try / catch

match require_asset_path(rel) {
    Err(e) if e.to_string().contains("runtime asset") => {
        eprintln!("{e}"); // message already lists searched paths
        eprintln!("repair the installation");
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling require_asset_path for a relative path that does not exist under any candidate root returned by candidate_roots().

Common situations: Incomplete installation (assets not shipped/installed); running a debug build from a directory without the asset tree; version upgrade where an asset was renamed; permission-restricted install prefix.

Related errors


AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01). Data as JSON: /api/errors/ecfa60acb7e2049e. Report an issue: GitHub.