{"record":{"id":"638cbf5609a1c969","repo":"BoundaryML/baml","slug":"getprocaddress-failed-for-s-error-code-d-w","errorCode":null,"errorMessage":"GetProcAddress failed for %s: error code %d: %w","messagePattern":"GetProcAddress failed for (.+?): error code (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"engine/language_client_go/baml_go/lib_windows.go","lineNumber":59,"sourceCode":"\n\treturn unsafe.Pointer(handle), nil\n}\n\n// getSymbol retrieves a symbol from the loaded library\nfunc getSymbol(handle unsafe.Pointer, name string) (unsafe.Pointer, error) {\n\tnamePtr, err := syscall.BytePtrFromString(name)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"invalid symbol name: %w\", err)\n\t}\n\n\tproc, _, err := procGetProcAddress.Call(\n\t\tuintptr(handle),\n\t\tuintptr(unsafe.Pointer(namePtr)),\n\t)\n\n\tif proc == 0 {\n\t\tlastErr, _, _ := procGetLastError.Call()\n\t\treturn nil, fmt.Errorf(\"GetProcAddress failed for %s: error code %d: %w\", name, lastErr, err)\n\t}\n\n\treturn unsafe.Pointer(proc), nil\n}\n\n// closeLibrary closes the loaded library\nfunc closeLibrary(handle unsafe.Pointer) error {\n\tif handle == nil {\n\t\treturn nil\n\t}\n\tret, _, err := procFreeLibrary.Call(uintptr(handle))\n\tif ret == 0 {\n\t\treturn fmt.Errorf(\"FreeLibrary failed: %w\", err)\n\t}\n\treturn nil\n}\n\n// platformInit performs any platform-specific initialization","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/engine/language_client_go/baml_go/lib_windows.go#L41-L77","documentation":"getSymbol on Windows reports this error when GetProcAddress returns 0, meaning the requested exported symbol does not exist in the loaded BAML DLL (or the handle is invalid). The message includes the symbol name, the GetLastError code, and the syscall error. This indicates a version mismatch between the Go bindings and the native library, or a broken handle.","triggerScenarios":"Looking up a BAML FFI symbol that the loaded DLL does not export — typically because the native .dll is an older/newer build than the Go bindings expect; also when called with a handle that LoadLibrary did not actually return.","commonSituations":"Mixed versions after a partial upgrade of the baml Go module while a stale DLL remains on disk or in the deployment; building bindings from source against a different native artifact; a cached/old DLL earlier on the DLL search path shadowing the correct one.","solutions":["Align versions: update the baml Go module and ensure the bundled native DLL comes from the same release (go mod tidy, clean rebuild).","Search the filesystem and DLL search path for duplicate/stale baml DLLs that may shadow the expected one; delete or reorder.","Verify the symbol exists in the deployed DLL (dumpbin /exports baml.dll) and compare with what the bindings request.","Reinstall the module and native artifacts to rule out a corrupted or partially-extracted DLL."],"exampleFix":"// before\n// go.mod pinned to baml v0.x but native lib from v0.y\nrequire github.com/boundaryml/baml v0.80.0\n\n// after\n// upgrade module so bindings and DLL are from the same release\ngo get github.com/boundaryml/baml@latest\ngo mod tidy\n# then delete stale baml*.dll copies from PATH directories","handlingStrategy":"validation","validationCode":"out, err := exec.Command(\"dumpbin\", \"/exports\", dllPath).Output()\nif err != nil || !strings.Contains(string(out), symbolName) {\n    return fmt.Errorf(\"symbol %s not exported by %s — version mismatch?\", symbolName, dllPath)\n}","typeGuard":"func symbolExported(dllPath, symbol string) bool {\n    out, err := exec.Command(\"dumpbin\", \"/exports\", dllPath).Output()\n    return err == nil && strings.Contains(string(out), symbol)\n}","tryCatchPattern":"proc, err := getSymbol(handle, name)\nif err != nil {\n    return fmt.Errorf(\"native library may be outdated for %s: %w — realign baml module and DLL versions\", name, err)\n}","preventionTips":["Always upgrade Go bindings and the native DLL from the same release.","Remove stale copies of the DLL from PATH directories that could shadow the bundled one.","Verify exports with dumpbin /exports when symbols go missing."],"tags":["windows","dynamic-linking","version-mismatch","dll"],"backgroundTag":"missing-dependency","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}