{"record":{"id":"16152f09e1cd2b12","repo":"cross-rs/cross","slug":"unable-to-find-provided-nix-store-directory-store","errorCode":null,"errorMessage":"unable to find provided nix-store directory {store:?}","messagePattern":"unable to find provided nix-store directory (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/docker/shared.rs","lineNumber":293,"sourceCode":"        if let Some(ref nix_store) = nix_store {\n            file::create_dir_all(nix_store)?;\n        }\n\n        // get our mount paths prior to canonicalizing them\n        let cargo_mount_path = cargo.as_posix_absolute()?;\n\n        // now that we know the paths exist, canonicalize them. this avoids creating\n        // directories after failed canonicalization into a shared directory.\n        let cargo = file::canonicalize(&cargo)?;\n\n        let default_nix_store = PathBuf::from(\"/nix/store\");\n        let nix_store = match nix_store {\n            Some(store) if store.exists() => {\n                let path = file::canonicalize(store)?;\n                Some(path)\n            }\n            Some(store) => {\n                eyre::bail!(\"unable to find provided nix-store directory {store:?}\");\n            }\n            None if cfg!(target_os = \"linux\") && default_nix_store.exists() => {\n                Some(default_nix_store)\n            }\n            None => None,\n        };\n\n        let cargo = mount_finder.find_mount_path(cargo);\n\n        // canonicalize these once to avoid syscalls\n        let sysroot_mount_path = toolchain.get_sysroot().as_posix_absolute()?;\n\n        Ok(ToolchainDirectories {\n            cargo,\n            nix_store,\n            toolchain,\n            cargo_mount_path,\n            sysroot_mount_path,","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/cross-rs/cross/blob/8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27/src/docker/shared.rs#L275-L311","documentation":"In the Nix cross-compilation path, `assemble` accepts a user-supplied nix-store directory. If one was explicitly provided (via config/flag) but does not exist on disk, it fails rather than silently falling back to the default store path.","triggerScenarios":"Calling `assemble` with `nix_store = Some(path)` where `path.exists()` is false — e.g. a custom store path pointing to a non-existent or typo'd directory.","commonSituations":"Nix store mounted at a non-default location that was moved/deleted, running outside the Nix environment where the configured store path doesn't exist, typos in config, or chroot/container contexts lacking the mount.","solutions":["Verify the configured nix-store path exists: `ls /nix/store` or the custom path; fix typos.","Remove the custom nix-store override so the default `/nix/store` is used when it exists.","Ensure you're running inside the Nix environment (nix-shell/nix develop) where the store is mounted."],"exampleFix":"// before\nlet opts = Options { nix_store: Some(\"/nx/store\".into()), .. } // typo\n// after\nlet opts = Options { nix_store: Some(\"/nix/store\".into()), .. }","handlingStrategy":"validation","validationCode":"if let Some(store) = &opts.nix_store {\n    if !store.exists() {\n        return Err(format!(\"nix-store path {} does not exist\", store.display()));\n    }\n}","typeGuard":"fn valid_nix_store(p: &std::path::Path) -> bool { p.is_dir() }","tryCatchPattern":null,"preventionTips":["Only set a custom nix-store path after verifying it exists on the build machine.","Prefer running inside nix-shell/nix develop so the default /nix/store is present.","Canonicalize the configured path in config-loading code to catch typos early."],"tags":["nix","filesystem","config","path"],"backgroundTag":"file-not-found","analyzedSha":"8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27","analyzedAt":"2026-09-13T15:10:43.988Z","contentChangedAt":"2026-09-13T15:10:43.988Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}