{"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":"critical","filePath":"crates/but/src/command/skill/mod.rs","lineNumber":1142,"sourceCode":"    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. An existing\n/// stub stays a stub on every rewrite, so refreshes never upgrade a layout by\n/// accident. Returns the version that was written.\npub(crate) fn write_skill_files(\n    install_path: &std::path::Path,\n    layout: SkillLayout,\n) -> 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 full_skill_md = prepare_skill_content(version)?;\n    let layout = match installed_layout(&install_path.join(\"SKILL.md\")) {\n        SkillLayout::Stub => SkillLayout::Stub,\n        SkillLayout::Full => layout,\n    };\n    let (skill_md_content, content_dir) = match layout {\n        SkillLayout::Full => (full_skill_md, install_path.join(\"references\")),\n        SkillLayout::Stub => {\n            let close = frontmatter_close(&full_skill_md)\n                .context(\"SKILL.md has no frontmatter to build a stub from\")?;\n            let stub = format!(\n                \"{}stub: true\\nallowed-tools: Bash(but skill:*)\\n{}{STUB_MD}\",","sourceCodeStart":1124,"sourceCodeEnd":1160,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/skill/mod.rs#L1124-L1160","documentation":"Skill file contents are embedded into the binary at build time (via include/embed mechanisms in SKILL_FILES). `write_skill_files` validates that none of the embedded contents are empty before writing, and bails with this internal-invariant error if they are, since writing empty skill files would silently produce a broken installation.","triggerScenarios":"Invoked from write_skill_files (freshness checks, installations, tests) when any entry in SKILL_FILES has an empty `content` field — i.e. a broken/incorrect build where the skill assets failed to be embedded.","commonSituations":"A locally built binary where the build script or include paths failed; using a development build without the VERSION/embed machinery; a packaging bug.","solutions":["Rebuild `but` from a clean checkout (cargo clean && cargo build) so the skill files are embedded.","Check the build script / embed configuration for the skill assets and fix paths.","If it persists in an official build, report it as a bug per the message."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// caller-side check before writing\nif SKILL_FILES.iter().any(|f| f.content.is_empty()) { eprintln!(\"broken build: empty embedded skill files\"); }\n","typeGuard":null,"tryCatchPattern":"match write_skill_files(path, layout) {\n    Err(e) if e.to_string().contains(\"not properly embedded\") => eprintln!(\"rebuild the binary\"),\n    other => other?,\n}","preventionTips":["Run `cargo clean` and rebuild after changing skill assets or build scripts.","Add a unit test asserting SKILL_FILES contents are non-empty.","Verify release packaging includes the skill asset files."],"tags":["build","embedded-assets","internal-error"],"backgroundTag":"empty-required-field","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}