{"record":{"id":"ecfa60acb7e2049e","repo":"nikivdev/code","slug":"runtime-asset-not-found-searched","errorCode":null,"errorMessage":"runtime asset '{}' not found. searched:\n{}","messagePattern":"runtime asset '(.+?)' not found\\. searched:\n(.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/runtime_assets.rs","lineNumber":31,"sourceCode":"\npub fn asset_path(relative: &str) -> Option<PathBuf> {\n    let relative = sanitize_relative(relative);\n    candidate_roots()\n        .into_iter()\n        .map(|root| root.join(relative))\n        .find(|candidate| candidate.exists())\n}\n\npub fn require_asset_path(relative: &str) -> Result<PathBuf> {\n    if let Some(path) = asset_path(relative) {\n        return Ok(path);\n    }\n\n    let searched = candidate_roots()\n        .into_iter()\n        .map(|root| root.join(sanitize_relative(relative)).display().to_string())\n        .collect::<Vec<_>>();\n    bail!(\n        \"runtime asset '{}' not found. searched:\\n{}\",\n        relative,\n        searched\n            .iter()\n            .map(|path| format!(\"- {path}\"))\n            .collect::<Vec<_>>()\n            .join(\"\\n\")\n    );\n}\n\nfn sanitize_relative(relative: &str) -> &Path {\n    Path::new(relative.trim_start_matches('/'))\n}\n\nfn candidate_roots() -> Vec<PathBuf> {\n    let mut roots = Vec::new();\n\n    if let Some(root) = env::var_os(FLOW_RUNTIME_ASSETS_ROOT_ENV).map(PathBuf::from) {","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/runtime_assets.rs#L13-L49","documentation":"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.","triggerScenarios":"Calling require_asset_path for a relative path that does not exist under any candidate root returned by candidate_roots().","commonSituations":"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.","solutions":["Reinstall/repair the application so runtime assets are present","Check the searched paths in the message and verify the asset exists at one of them","Confirm the relative path argument matches the shipped asset name (sanitization may alter it)","Update to a version where the asset still exists"],"exampleFix":"// before\nlet p = require_asset_path(\"scripts/old-helper.sh\")?;  // renamed upstream\n// after\nlet p = require_asset_path(\"scripts/helper.sh\")?;","handlingStrategy":"fallback","validationCode":"fn asset_available(relative: &str) -> bool {\n    candidate_roots().iter().any(|r| r.join(sanitize_relative(relative)).exists())\n}\nif !asset_available(\"scripts/helper.sh\") { eprintln!(\"asset missing; reinstall\"); return; }","typeGuard":null,"tryCatchPattern":"match require_asset_path(rel) {\n    Err(e) if e.to_string().contains(\"runtime asset\") => {\n        eprintln!(\"{e}\"); // message already lists searched paths\n        eprintln!(\"repair the installation\");\n    }\n    other => other?,\n}","preventionTips":["Run the installer's verify/repair step after upgrades","Log candidate_roots() at startup to catch packaging drift early","Keep the relative path constants in one place synced with the packaged asset list"],"tags":["filesystem","assets","missing-file"],"backgroundTag":"asset-not-found","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}