{"record":{"id":"ad80433eca8bc240","repo":"cross-rs/cross","slug":"source-is-pointing-to-a-directory-instead-of-its-contents","errorCode":null,"errorMessage":"source is pointing to a directory instead of its contents: {} -> {}\nThis might be a bug. {}","messagePattern":"source is pointing to a directory instead of its contents: (.+?) -> (.+?)\nThis might be a bug\\. (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/docker/remote.rs","lineNumber":87,"sourceCode":"    /// copy the contents from `src` into `dst`, `src` must end with `/.`\n    #[track_caller]\n    fn copy_files(\n        &self,\n        src: &Path,\n        reldst: &str,\n        mount_prefix: &str,\n        msg_info: &mut MessageInfo,\n    ) -> Result<ExitStatus> {\n        if let Some((_, rel)) = reldst.rsplit_once('/') {\n            if msg_info.cross_debug\n                && src.is_dir()\n                && !src.to_string_lossy().ends_with(\"/.\")\n                && rel\n                    == src\n                        .file_name()\n                        .expect(\"filename should be defined as we are a directory\")\n            {\n                msg_info.warn(format_args!(\n                    \"source is pointing to a directory instead of its contents: {} -> {}\\nThis might be a bug. {}\",\n                    src.as_posix_relative()?,\n                    reldst,\n                    std::panic::Location::caller()\n                ))?;\n            }\n        }\n        subcommand_or_exit(self.engine, \"cp\")?\n            .arg(\"-a\")\n            .arg(src.to_utf8()?)\n            .arg(format!(\"{}:{mount_prefix}/{reldst}\", self.container))\n            .run_and_get_status(msg_info, false)\n    }\n\n    /// copy files for a docker volume, does not include cache directories\n    ///\n    /// ## Note\n    ///","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/cross-rs/cross/blob/8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27/src/docker/remote.rs#L69-L105","documentation":"During remote builds, copy_files copies paths into the data volume. When a source path resolves to a directory but the destination expects its contents (the relative path equals the directory's file name and does not end in `/.`), cross warns that the caller probably pointed at the directory itself rather than its children — flagged as a possible bug in cross's own copy logic.","triggerScenarios":"Calling copy_files (directly or via copy_files_nocache, copy_file_list, copy_cargo, copy_rust_base, copy_rust_manifest, copy_rust_triple) with a src directory whose destination relationship makes rel == src.file_name(), i.e. contents land one level deeper than intended.","commonSituations":"Remote builds where the cargo home/toolchain directories layout changed between cross versions; symlinks or bind-mount layouts causing a directory to appear as a copy source; genuine cross bugs filed upstream.","solutions":["Update cross to the latest version; this message explicitly hints at an internal bug that may already be fixed.","Check which path is being copied (the message prints src -> dst) and ensure the source points at the contents (e.g. append `/.`) if you control the copy.","If the paths are cross-managed (cargo/rust directories), clear stale directories (e.g. the cross home/cache) so they are recreated with the expected layout.","File an issue with cross including the printed source/destination and panic Location if it persists."],"exampleFix":"// before\nlet src = Path::new(\"/home/user/.cargo/registry\");\ncopy_files(src, dst)?;\n\n// after — point at contents when a directory copy is intended\nlet src = Path::new(\"/home/user/.cargo/registry/.\");\ncopy_files(src, dst)?;","handlingStrategy":"fallback","validationCode":"// Detect suspicious directory-source copies before invoking cross remote builds\nuse std::fs;\nif fs::metadata(src)?.is_dir() && !src.ends_with(\"/.\") {\n    eprintln!(\"copy source {} is a directory; cross may warn\", src.display());\n}","typeGuard":null,"tryCatchPattern":"// Treat as non-fatal warning; escalate only if the remote build then fails\nif let Err(e) = run_cross_remote() {\n    if String::from_utf8_lossy(&e.stderr).contains(\"pointing to a directory instead of its contents\") {\n        update_cross_and_retry()?;\n    } else { return Err(e); }\n}","preventionTips":["Keep cross up to date — the message flags a potential internal bug","Clear stale cross home/cache directories after upgrades","When copying directories into build contexts yourself, reference contents with a trailing /."],"tags":["docker","remote","file-copy","path"],"backgroundTag":"incompatible-source-type","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"}