{"record":{"id":"c11939f3fe89a80f","repo":"BoundaryML/baml","slug":"failed-to-compute-relative-path-from-to","errorCode":null,"errorMessage":"Failed to compute relative path from {} to {}","messagePattern":"Failed to compute relative path from (.+?) to (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/cli/src/deploy.rs","lineNumber":44,"sourceCode":"\n// Constants (replace with actual values as needed)\n#[derive(clap::Args, Debug)]\npub struct DeployArgs {\n    #[arg(long, help = \"path/to/baml_src\", default_value = \"./baml_src\")]\n    pub(super) from: PathBuf,\n\n    #[arg(\n        long,\n        env = \"NEXT_PUBLIC_BOUNDARY_API_URL\",\n        default_value = \"https://api2.boundaryml.com\",\n        hide = true\n    )]\n    pub(super) api_url: String,\n}\n\nfn relative_path_to_baml_src(path: &Path, baml_src: &Path) -> Result<PathBuf> {\n    pathdiff::diff_paths(path, baml_src).ok_or_else(|| {\n        anyhow::anyhow!(\n            \"Failed to compute relative path from {} to {}\",\n            path.display(),\n            baml_src.display()\n        )\n    })\n}\n\nimpl DeployArgs {\n    /// Implementation notes:\n    ///\n    ///   - selected dialoguer / indicatif based on https://fadeevab.com/comparison-of-rust-cli-prompts/\n    pub async fn run_async(\n        &self,\n        feature_flags: internal_baml_core::feature_flags::FeatureFlags,\n    ) -> Result<()> {\n        let runtime =\n            BamlRuntime::from_directory(&self.from, std::env::vars().collect(), feature_flags)\n                .context(\"Failed to build BAML runtime\")?;","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/cli/src/deploy.rs#L26-L62","documentation":"BAML CLI deployment computes a path relative to the baml_src directory using pathdiff. When the two paths cannot be related (e.g. differing path components/windows prefixes that make a relative path impossible), it throws this error instead of producing a bogus path.","triggerScenarios":"Calling deploy (relative_path_to_baml_src via deploy_project_no_progress_spinner) with a path argument that is not on the same filesystem root/prefix as the resolved baml_src directory, such as passing an absolute Windows path with a different drive, or a path that is not under/related to the project root.","commonSituations":"Running `baml deploy` from a different drive (C:\\ vs D:\\ on Windows), symlinking the baml_src directory across mounts, or passing an --from path outside the project tree.","solutions":["Run the deploy command with paths on the same drive/filesystem as the baml_src directory","Pass an absolute path that shares a common ancestor with baml_src","Remove symlinks/mounts between the target path and baml_src and use the real path","On Windows, ensure both paths use the same drive letter"],"exampleFix":"// before\nbaml deploy --from D:\\other\\project\n// after\nbaml deploy --from C:\\work\\my-project  # same drive as baml_src","handlingStrategy":"validation","validationCode":"fn is_deployable(path: &Path, baml_src: &Path) -> bool {\n    pathdiff::diff_paths(path, baml_src).is_some()\n}","typeGuard":null,"tryCatchPattern":"match relative_path_to_baml_src(&p, &src) {\n    Ok(rel) => use(rel),\n    Err(e) => eprintln!(\"Cannot make path relative to baml_src: {e:#}\"),\n}","preventionTips":["Use absolute paths on the same drive/filesystem as baml_src","Avoid symlinks across mounts for the BAML project directory","Test deploy commands on Windows with same-drive paths"],"tags":["cli","filesystem","path-resolution"],"backgroundTag":"invalid-argument-value","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}