{"record":{"id":"0dc89dcbf0f0bbe2","repo":"BoundaryML/baml","slug":"failed-to-download-extension","errorCode":null,"errorMessage":"Failed to download extension: {}","messagePattern":"Failed to download extension: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/baml-runtime/src/cli/init.rs","lineNumber":244,"sourceCode":"    } else {\n        install_extension_manually(\"cursor\");\n    }\n}\n\nfn download_vsix(url: &str, filename: &str) -> Result<PathBuf> {\n    let temp_dir = std::env::temp_dir();\n    let vsix_path = temp_dir.join(filename);\n\n    baml_log::info!(\"Downloading BAML extension to: {}\", vsix_path.display());\n\n    // Use curl to download the file\n    let curl_args = vec![\"-L\", \"-o\", vsix_path.to_str().unwrap(), url];\n\n    let output = Command::new(\"curl\").args(&curl_args).output()?;\n\n    if !output.status.success() {\n        let stderr = String::from_utf8_lossy(&output.stderr);\n        anyhow::bail!(\"Failed to download extension: {}\", stderr);\n    }\n\n    // Verify the file was downloaded\n    if !vsix_path.exists() {\n        anyhow::bail!(\"VSIX file was not created at expected location\");\n    }\n\n    Ok(vsix_path)\n}\n\nconst BAML_MDC: &str = include_str!(\"initial_project/baml.mdc\");\n\nfn copy_cursor_rules(dest_path: &std::path::Path) {\n    let cursor_rules_dir = dest_path.join(\".cursor\").join(\"rules\");\n\n    // Create the .cursor/rules directory if it doesn't exist\n    if let Err(e) = fs::create_dir_all(&cursor_rules_dir) {\n        baml_log::info!(\"Could not create .cursor/rules directory: {}\", e);","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/baml-runtime/src/cli/init.rs#L226-L262","documentation":"download_vsix in `baml-cli init` shells out to `curl -L -o <vsix_path> <url>` to fetch the BAML editor extension as a VSIX file. If curl exits with a non-zero status, the collected stderr is surfaced as this error. It indicates the extension download failed at the HTTP/network level.","triggerScenarios":"install_extension_manually -> download_vsix when `Command::new(\"curl\")...output()` returns a failed status: bad URL, no network access, proxy blocking GitHub, 404 from marketplace, TLS issues.","commonSituations":"Corporate proxy/firewall blocking the marketplace domain, offline CI, expired marketplace URL after an extension version change, missing CA certificates.","solutions":["Check the stderr embedded in the error message for the actual curl failure (DNS, 404, TLS, proxy).","Test the download manually with `curl -L -o /tmp/baml.vsix <url>` using the URL from the error context.","Ensure network/proxy access: set HTTPS_PROXY/HTTP_PROXY or add the marketplace to your proxy allowlist.","Install the extension manually: download the VSIX in a browser and run `code --install-extension baml.vsix` instead of the manual path."],"exampleFix":"// before (fails behind proxy)\ncurl -L -o baml.vsix https://marketplace.../baml.vsix\n// after\nexport HTTPS_PROXY=http://proxy.corp:8080\nbaml init","handlingStrategy":"retry","validationCode":"# preflight connectivity to the marketplace host\ncurl -fsIL \"$URL\" >/dev/null || echo 'marketplace unreachable'","typeGuard":null,"tryCatchPattern":"catch (e) {\n  if (String(e.message).includes('Failed to download extension')) {\n    // inspect embedded curl stderr, fix proxy/network, retry once\n  }\n}","preventionTips":["Configure HTTPS_PROXY for corporate networks before running init.","Preinstall the extension manually to skip the VSIX download path.","Allowlist marketplace.visualstudio.com / open-vsx domains."],"tags":["network","curl","download","vscode"],"backgroundTag":"http-request-failed","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"}