{"record":{"id":"6d6b50a04099a930","repo":"cross-rs/cross","slug":"artifact-path-artifact-path-does-not-start-with-mount-target","errorCode":null,"errorMessage":"artifact path {artifact_path} does not start with {mount_target_dir}, skipping","messagePattern":"artifact path (.+?) does not start with (.+?), skipping","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/docker/remote.rs","lineNumber":597,"sourceCode":"\nfn copy_artifacts_from_container(\n    engine: &Engine,\n    container_id: &str,\n    artifact_files: &[String],\n    host_target_dir: &Path,\n    mount_target_dir: &str,\n    msg_info: &mut MessageInfo,\n) -> Result<()> {\n    for artifact_path in artifact_files {\n        let artifact_path = artifact_path.trim();\n        if artifact_path.is_empty() {\n            continue;\n        }\n\n        let relative = if let Some(pos) = artifact_path.find(mount_target_dir) {\n            &artifact_path[pos + mount_target_dir.len()..]\n        } else {\n            msg_info.warn(format_args!(\n                \"artifact path {artifact_path} does not start with {mount_target_dir}, skipping\"\n            ))?;\n            continue;\n        };\n\n        let host_path = host_target_dir.join(relative.trim_start_matches('/'));\n\n        if let Some(parent) = host_path.parent() {\n            fs::create_dir_all(parent)?;\n        }\n\n        subcommand_or_exit(engine, \"cp\")?\n            .arg(format!(\"{container_id}:{artifact_path}\"))\n            .arg(&host_path)\n            .run_and_get_status(msg_info, false)?;\n    }\n    Ok(())\n}","sourceCodeStart":579,"sourceCodeEnd":615,"githubUrl":"https://github.com/cross-rs/cross/blob/8c1a8aa4b661711f4b7b6ac07c2e8929ce2f7d27/src/docker/remote.rs#L579-L615","documentation":"After running a remote build, copy_artifacts_from_container lists produced artifacts and maps each container path to a host path by locating the mount target directory prefix. Any artifact path that does not contain the mount prefix cannot be mapped, so it is warned about and skipped rather than failing the run.","triggerScenarios":"During run (remote build), an artifact path reported by the container does not contain mount_target_dir, so `artifact_path.find(mount_target_dir)` returns None and the artifact is skipped.","commonSituations":"Custom target-dir or CARGO_TARGET_DIR settings inside the container placing artifacts outside the mounted /target; build scripts writing outputs to unexpected locations; misconfigured artifact mounting in cross options.","solutions":["Ensure the build's target directory is the default (/target inside the container mount) — unset custom CARGO_TARGET_DIR overrides.","Check cross's target mount options in Cross.toml / CLI flags so mount_target_dir matches where cargo actually writes artifacts.","Inspect the build for scripts that copy artifacts to other paths and correct them.","Update cross if a recent change altered the mount layout."],"exampleFix":"# before\nCARGO_TARGET_DIR=/custom/target cross build --target aarch64-unknown-linux-gnu\n\n# after — let cross manage the target dir\nunset CARGO_TARGET_DIR\ncross build --target aarch64-unknown-linux-gnu","handlingStrategy":"validation","validationCode":"# Before a remote build, make sure no custom target dir leaks in\nif [ -n \"${CARGO_TARGET_DIR:-}\" ]; then\n  echo \"CARGO_TARGET_DIR must be unset for cross remote builds\"; exit 1\nfi","typeGuard":null,"tryCatchPattern":"// Treat skipped artifacts as suspicious; fail if no artifacts were copied\nlet copied = copy_artifacts_from_container(...)?;\nif copied.is_empty() { return Err(anyhow!(\"no artifacts mapped from container\")); }","preventionTips":["Never set CARGO_TARGET_DIR for cross remote builds","Keep build scripts writing only into the standard target dir","Verify artifact paths in CI logs when the warning appears"],"tags":["docker","remote","artifacts","path"],"backgroundTag":"unexpected-response-shape","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"}