https://www.boundaryml.com logo
Using BAML with go
# help
w
I have been following the instructions at https://docs.boundaryml.com/guide/installation-language/go I am on windows system. On giving this command C:\Shoun\Whatsapp-agent>go install github.com/boundaryml/baml/baml-cli@latest && baml-cli init 2025-12-18T14:39:21.170 [BAML WARN] Could not get checksum. Download will proceed without verification. checksum_url="https://github.com/boundaryml/baml/releases/download/0.215.0/baml_cffi-x86_64-pc-windows-msvc.dll.sha256" error=checksum file not found (404) 2025-12-18T14:39:22.225 [BAML WARN] BAML library download failed: baml: failed to download shared library: library file not found at https://github.com/boundaryml/baml/releases/download/0.215.0/baml_cffi-x86_64-pc-windows-msvc.dll (HTTP 404). Check release tag 'v0.215.0' and filename 'baml_cffi-x86_64-pc-windows-msvc.dll' 2025-12-18T14:39:22.226 [BAML ERROR] Failed to find BAML library after all attempts version="0.215.0" os="windows" arch="amd64" checked_env_var="BAML_LIBRARY_PATH" checked_cache_path="C:\\Users\\sdas18\\AppData\\Local\\baml\\libs\\0.215.0\\baml_cffi-x86_64-pc-windows-msvc.dll" download_disabled="" checked_system_paths=[C:\Program Files\baml\baml_cffi-0.215.0.dll C:\Program Files\baml\baml_cffi.dll C:\Users\sdas18\AppData\Local\baml\baml_cffi-0.215.0.dll C:\Users\sdas18\AppData\Local\baml\baml_cffi.dll] panic: baml: initialization failed: baml: failed loading shared library: could not find BAML library v0.215.0 for windows/amd64. Resolution attempts failed: - Explicit path (SetSharedLibraryPath): Checked, not found or invalid
- Environment var (BAML_LIBRARY_PATH): Not set - Cache path: C:\Users\sdas18\AppData\Local\baml\libs\0.215.0\baml_cffi-x86_64-pc-windows-msvc.dll (not found) - Download (BAML_LIBRARY_DISABLE_DOWNLOAD): Attempted but failed - Default system paths: [C:\Program Files\baml\baml_cffi-0.215.0.dll C:\Program Files\baml\baml_cffi.dll C:\Users\sdas18\AppData\Local\baml\baml_cffi-0.215.0.dll C:\Users\sdas18\AppData\Local\baml\baml_cffi.dll] (not found) goroutine 1 [running]: github.com/boundaryml/baml/engine/language_client_go/baml_go.init.0.func1() C:/Users/sdas18/go/pkg/mod/github.com/boundaryml/baml@v0.215.0/engine/language_client_go/baml_go/lib_common.go:110 +0x54 sync.(*Once).doSlow(0x7ff7312a7ffa?, 0x7ff73137c920?) C:/Program Files/Go/src/sync/once.go:78 +0xac sync.(*Once).Do(...) C:/Program Files/Go/src/sync/once.go:69 github.com/boundaryml/baml/engine/language_client_go/baml_go.init.0() C:/Users/sdas18/go/pkg/mod/github.com/boundaryml/baml@v0.215.0/engine/language_client_go/baml_go/lib_common.go:107 +0x31
Therefore i tried to C:\Shoun\Whatsapp-agent>go install github.com/boundaryml/baml/baml-cli@v0.214.0 && baml-cli init and i could proceed but i still got stuck at the last step C:\Shoun\Whatsapp-agent>baml-cli generate 2025-12-18T14:57:15.802 [BAML INFO] Found valid cached BAML library path="C:\\Users\\sdas18\\AppData\\Local\\baml\\libs\\0.214.0\\baml_cffi-x86_64-pc-windows-msvc.dll" 2025-12-18T14:57:15.811 [BAML INFO] BAML (v0.214.0) loaded 2025-12-18T14:57:15.814 [BAML INFO] Generating clients with CLI version: 0.214.0 2025-12-18T14:57:15.839 [BAML INFO] Wrote 19 files to baml_client 2025-12-18T14:57:15.839 [BAML INFO] Running "gofmt -w . && goimports -w ." in baml_client 2025-12-18T14:57:15.840 [BAML ERROR] Failed to execute on_generate command: Failed to run on_generate command: gofmt -w . && goimports -w . 2025-12-18T14:57:15.841 [BAML ERROR] Error generating clients: Client generation failed Caused by: 0: Failed to run on_generate command: gofmt -w . && goimports -w . 1: program not found Error: Client generation failed
v
tracking this!
Copy code
vbv@Vaibhavs-MacBook-Pro-2 go-example % go install github.com/boundaryml/baml/baml-cli@v0.214.0                 

vbv@Vaibhavs-MacBook-Pro-2 go-example % ~/go/bin/baml-cli 
2025-12-18T07:45:56.101 [BAML WARN] Could not get checksum. Download will proceed without verification. checksum_url="https://github.com/boundaryml/baml/releases/download/0.214.0/libbaml_cffi-aarch64-apple-darwin.dylib.sha256" error=checksum file not found (404)
Downloading libbaml_cffi-aarch64-apple-darwin.dylib [========================================] 43.2 MiB / 43.2 MiB 100% (16.6 MiB/s)    
2025-12-18T07:45:59.246 [BAML WARN] Checksum verification skipped (checksum file not found or download failed)
2025-12-18T07:45:59.246 [BAML INFO] Successfully downloaded and cached BAML library path="/Users/vbv/Library/Caches/baml/libs/0.214.0/libbaml_cffi-aarch64-apple-darwin.dylib"
2025-12-18T07:45:59.733 [BAML INFO] BAML (v0.214.0) loaded
A CLI tool for working with BAML. Learn more at https://docs.boundaryml.com.

Usage: baml-cli [OPTIONS] <COMMAND>

Commands:
  init      Initialize a new BAML project.
  generate  Runs all generators in the baml_src directory
  check     Checks for errors and warnings in the baml_src directory
  serve     Starts a server that translates LLM responses to BAML responses
  dev       Starts a development server
  test      Run BAML tests
  lsp       Starts a language server
  help      Print this message or the help of the given subcommand(s)

Options:
      --features <FEATURE>  Enable specific features (can be specified multiple times)
  -h, --help                Print help (see more with '--help')
  -V, --version             Print version
vbv@Vaibhavs-MacBook-Pro-2 go-example % ~/go/bin/baml-cli  init
2025-12-18T07:46:03.063 [BAML INFO] Found valid cached BAML library path="/Users/vbv/Library/Caches/baml/libs/0.214.0/libbaml_cffi-aarch64-apple-darwin.dylib"
2025-12-18T07:46:03.065 [BAML INFO] BAML (v0.214.0) loaded

vbv@Vaibhavs-MacBook-Pro-2 go-example % baml-cli generate
2025-12-18T07:46:12.795 [BAML INFO] Found valid cached BAML library path="/Users/vbv/Library/Caches/baml/libs/0.214.0/libbaml_cffi-aarch64-apple-darwin.dylib"
2025-12-18T07:46:12.800 [BAML INFO] BAML (v0.214.0) loaded
2025-12-18T07:46:12.801 [BAML INFO] Generating clients with CLI version: 0.214.0
2025-12-18T07:46:12.811 [BAML INFO] Wrote 19 files to baml_client
2025-12-18T07:46:12.811 [BAML INFO] Running "gofmt -w . && goimports -w ." in baml_client
2025-12-18T07:46:13.423 [BAML INFO] Generated 1 baml_client: ../baml_client
so this appeared to work. do you have goimports installed?
I wonder if github made the url case sensitive....
w
pretty sure I have both goimports and gofmt because i am getting this C:\Shoun\Whatsapp-agent>gofmt -h usage: gofmt [flags] [path ...] -cpuprofile string write cpu profile to this file -d display diffs instead of rewriting files -e report all errors (not just the first 10 on different lines) -l list files whose formatting differs from gofmt's -r string rewrite rule (e.g., 'a[b:len(a)] -> a[b:]') -s simplify code -w write result to (source) file instead of stdout C:\Shoun\Whatsapp-agent>goimports -h usage: goimports [flags] [path ...] -cpuprofile string CPU profile output -d display diffs instead of rewriting files -e report all errors (not just the first 10 on different lines) -format-only if true, don't fix imports an
v
hmm, do you want to hop on office hours really quick and screenshare?
w
sure
could you hear me?
this is likely better (discord audio can be funky for some people)
w
installing zoom rn
v
found the bug! when we run
on_generate
we depend on
sh
being installed. on windows, that isn't available by default, and only wsl / git bash make it available. its not a guarantee every developer / company allows that to be installed. We (the baml team) should be able to fix this soon! thanks for your help with debugging this @WickedHero !
2 Views