{"record":{"id":"21992a709de59832","repo":"gitbutlerapp/gitbutler","slug":"skill-files-were-not-properly-embedded-at-build-ti","errorCode":null,"errorMessage":"Skill files were not properly embedded at build time. Please report this as a bug.","messagePattern":"Skill files were not properly embedded at build time\\. Please report this as a bug\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/skill/mod.rs","lineNumber":985,"sourceCode":"\n/// Prepare SKILL.md content with version injection and validate all files\nfn prepare_skill_content(version: &str) -> Result<String> {\n    // Validate all embedded files are valid UTF-8\n    let skill_content = std::str::from_utf8(SKILL_MD).context(\"SKILL.md is not valid UTF-8\")?;\n    std::str::from_utf8(CONCEPTS_MD).context(\"concepts.md is not valid UTF-8\")?;\n    std::str::from_utf8(EXAMPLES_MD).context(\"examples.md is not valid UTF-8\")?;\n    std::str::from_utf8(REFERENCE_MD).context(\"reference.md is not valid UTF-8\")?;\n\n    // Inject version into SKILL.md\n    Ok(inject_version(skill_content, version))\n}\n\n/// Write the bundled skill files into `install_path`, creating the directory\n/// structure as needed and injecting the CLI version into SKILL.md. Returns the\n/// version that was written.\npub(crate) fn write_skill_files(install_path: &std::path::Path) -> Result<&'static str> {\n    if SKILL_FILES.iter().any(|f| f.content.is_empty()) {\n        anyhow::bail!(\n            \"Skill files were not properly embedded at build time. Please report this as a bug.\"\n        );\n    }\n\n    // Prepare all content before writing (validate UTF-8 and inject version)\n    let version = option_env!(\"VERSION\").unwrap_or(\"dev\");\n    let skill_md_content = prepare_skill_content(version)?;\n\n    let references_dir = install_path.join(\"references\");\n    std::fs::create_dir_all(&references_dir).with_context(|| {\n        format!(\n            \"Failed to create skill directory at {}. Check that you have write permissions for this location.\",\n            install_path.display()\n        )\n    })?;\n\n    for file in skill_files_in_write_order() {\n        let file_path = file.get_install_path(install_path);","sourceCodeStart":967,"sourceCodeEnd":1003,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/skill/mod.rs#L967-L1003","documentation":"write_skill_files embeds the skill assets (SKILL.md, references, examples) into the binary at compile time via the SKILL_FILES table. Before writing anything it verifies no embedded blob is empty; an empty blob means the compile-time embedding never happened (missing or zero-length asset files at build time), which is a build/packaging defect. Failing here prevents writing empty files to the user's disk.","triggerScenarios":"Building crates/but from a source tree where the skill asset files under crates/but/skill are missing or zero-length at compile time; packaging scripts that strip assets; a corrupted cargo cache reusing stale artifacts.","commonSituations":"Nightly packaging jobs, source tarballs created without the skill assets, sparse git checkouts excluding the asset directory, downstream distro builds.","solutions":["Report the bug to GitButler including the binary's version","Rebuild from a clean complete checkout: cargo clean && cargo build","Fall back to an official GitButler release binary","Verify the skill asset files exist and are non-empty under crates/but/skill before compiling"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match write_skill_files(&install_path) {\n    Err(e) if e.to_string().contains(\"not properly embedded\") => {\n        // build defect: do not retry; report binary version and rebuild\n    }\n    other => other,\n}","preventionTips":["Add a CI smoke test that runs `but skill install --path` on release builds","Assert SKILL_FILES assets are non-empty in a build-time unit test","Package only from full checkouts, never stripped tarballs"],"tags":["build","embedded-assets","packaging","skill","internal-error"],"backgroundTag":"missing-embedded-resource","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}