Fixing FoundationDB Unsupported Version Errors using Go (golang) Bindings

I’ve been hearing some great things about FoundationDB recently and wanted to run it through the paces for a personal project I’ve been working on lately. Unfortunately, the experience to get started had a little friction. I hope this post helps others searching for quick tips to get FoundationDB working with Go.

I expect this guidance will be valid for current and future versions of FoundationDB; however, I wrote it using FoundationDB 6.0.15.

FoundationDB Golang Version Errors

After installing FoundationDB on my MacBook Pro, I downloaded the repository to my machine at $GOPATH/src/, copied the “Hello World” example from the Go bindings and was disappointed I could not get the example to compile. I received two different errors complaining about unsupported versions such as:

panic: FoundationDB error code 2203 (API version not supported)

How to get Golang Bindings working with FoundationDB

For me, the primary issue was a version conflict between FoundationDB I installed, the code sample I was compiling (Hello World), and the release (tag) I had checked out when I downloaded the repository. The following steps should get you up and running:

Step 1: Download and Install FoundationDB

This step is out of scope for this post. I found the process easy and intuitive. This link should get you started.

Step 2: Clone the FoundationDB Git Repository

makdir -p $GOPATH/src/
cd $GOPATH/src/
git clone

Step 3: Checkout the Right Release/Tag to Fix Version Error

This is the important part. You need to check out the appropriate branch/tag for the installed version of FoundationDB before you compile the Hello World example.

To determine which version of FoundationDB you have installed you run (mine was v6.0.15):

 $ fdbcli -v
FoundationDB CLI 6.0 (v6.0.15)
source version 8903c5f6212a0dd927c69c094b3b84d38ef7a62d
protocol fdb00a570010001

To resolve the error, from the $GOPATH/src/ directory, I ran git tag to see what tags are available. After I looked at the organization of the FoundationDB repository I observed a convention of creating a branch for each release with tags for each major/minor release, checked out the right version, and ran the installer:

cd $GOPATH/src/
git checkout 6.0.15
cd $GOPATH/src/
./ localinstall

Step 4: Compile the Hello World App

The following code, was copied from the Godoc for the package; however, I had to make one change for my configuration. Specifically, I had to set fdb.MustAPIVersion(600) where the original example I found online was fdb.MustAPIVersion(610).

package main

import (


func main() {

	// Different API versions may expose different runtime behaviors.

	// Open the default database from the system cluster
	db := fdb.MustOpenDefault()

	// Database reads and writes happen inside transactions
	ret, e := db.Transact(func(tr fdb.Transaction) (interface{}, error) {
		tr.Set(fdb.Key("hello"), []byte("world"))
		return tr.Get(fdb.Key("foo")).MustGet(), nil
		// db.Transact automatically commits (and if necessary,
		// retries) the transaction
	if e != nil {
		log.Fatalf("Unable to perform FDB transaction (%v)", e)

	fmt.Printf("hello is now world, foo was: %s\n", string(ret.([]byte)))

As I write this, I don’t understand why fdb.MustAPIVersion(600) works and not 615 or even a lower number. As I continue to explore FoundationDB I expect to solve this small mystery. At this time, I’m off to start playing with another database… one with a compelling feature set. Thanks to Apple for open sourcing FoundationDB!