{"record":{"id":"81829fac4d6b2449","repo":"tauri-apps/tauri","slug":"failed-to-write-checked-features-file","errorCode":null,"errorMessage":"failed to write checked_features file","messagePattern":"failed to write checked_features file","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tauri/build.rs","lineNumber":267,"sourceCode":"  let mut checked_features = Vec::new();\n  let custom_protocol = has_feature(&mut checked_features, \"custom-protocol\");\n  let dev = !custom_protocol;\n  alias(\"custom_protocol\", custom_protocol);\n  alias(\"dev\", dev);\n\n  println!(\"cargo:dev={dev}\");\n\n  let target_os = std::env::var_os(\"CARGO_CFG_TARGET_OS\").unwrap();\n  let mobile = target_os == \"ios\" || target_os == \"android\";\n  alias(\"desktop\", !mobile);\n  alias(\"mobile\", mobile);\n\n  let out_dir = PathBuf::from(env::var_os(\"OUT_DIR\").unwrap());\n\n  let checked_features_out_path = out_dir.join(\"checked_features\");\n  // file is used by a unit test in src/lib.rs to check that the features checked do exist in the Cargo.toml\n  std::fs::write(checked_features_out_path, checked_features.join(\",\"))\n    .expect(\"failed to write checked_features file\");\n\n  // workaround needed to prevent `STATUS_ENTRYPOINT_NOT_FOUND` error in tests\n  // see https://github.com/tauri-apps/tauri/pull/4383#issuecomment-1212221864\n  let target_env = std::env::var_os(\"CARGO_CFG_TARGET_ENV\");\n  let is_tauri_workspace = std::env::var_os(\"__TAURI_WORKSPACE__\").is_some_and(|v| v == \"true\");\n  if is_tauri_workspace && target_os == \"windows\" && target_env.is_some_and(|trgt| trgt == \"msvc\") {\n    embed_manifest_for_tests();\n  }\n\n  if target_os == \"android\" {\n    fn env_var(var: &str) -> String {\n      std::env::var(var).unwrap_or_else(|_| {\n        panic!(\"`{var}` is not set, which is needed to generate the kotlin files for android.\")\n      })\n    }\n\n    if let Some(kotlin_out_dir) = std::env::var_os(\"WRY_ANDROID_KOTLIN_FILES_OUT_DIR\") {\n      let package = env_var(\"WRY_ANDROID_PACKAGE\");","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/tauri-apps/tauri/blob/460ec35447493200d64290dd7f015d5a91d0fd58/crates/tauri/build.rs#L249-L285","documentation":"In tauri's own build script, after determining the enabled Cargo features, the script writes the comma-joined feature list to `OUT_DIR/checked_features` (consumed by a unit test in src/lib.rs) and panics with this message if the write fails. A failure means the build output directory is not writable or missing.","triggerScenarios":"Building the `tauri` crate when `OUT_DIR` is missing, read-only, or the `checked_features` path cannot be created — e.g. restricted CI sandboxes, disk-full, or a nonstandard `--target-dir` with bad permissions.","commonSituations":"Docker/CI containers running cargo as a non-root user with read-only target dirs; read-only mounted target directories; full disks; Windows ACL/antivirus interference.","solutions":["Check the `target` directory is writable by the build user (fix ownership/permissions)","Free disk space if the volume is full","Remove unusual `--target-dir` overrides or give that directory write permissions","Re-run the build after fixing the environment"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"let out_dir = PathBuf::from(env::var_os(\"OUT_DIR\").unwrap());\nassert!(out_dir.is_dir() && !out_dir.permissions().readonly(), \"OUT_DIR must be writable\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the build user owns the target directory in CI/Docker","Monitor disk space on build machines","Avoid read-only mounts over the cargo target dir"],"tags":["build-script","file-write","panic","filesystem","tauri"],"backgroundTag":"file-write-failed","analyzedSha":"460ec35447493200d64290dd7f015d5a91d0fd58","analyzedAt":"2026-09-18T23:55:51.277Z","contentChangedAt":"2026-09-18T23:55:51.277Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}