Sync Gateway does not save new databases added by REST API


I am using the Rest API to create a new entry in the Sync Gateway.

I started the gateway by this command:

sync_gateway.exe -adminInterface=":4985" -interface=":80" -url=“walrus:data” -verbose=“true”

data/sync_gateway.walrus has been created.

Now I use the REST API to create a new database:

curl -X PUT -H “Content-Type: application/json” -d “{ “server”: “”, “sync”: “function(doc) { channel(doc.channels); }”, “bucket”: “new-bucket” }” http://localhost:4985/new-bucket-sync/

On first try I always get this error:

12:47:26.104660 HTTP: #022: PUT /new-bucket-sync/ (ADMIN)
12:47:26.104660 Opening db /new-bucket-sync as bucket “new-bucket”, pool “default”, server
12:47:26.105160 Opening Couchbase database new-bucket on <http.//>
12:47:26.293698 WARNING: Error from Incr in lastSequence(): MCResponse status=DELTA_BADVAL, opcode=INCREMENT, opaque=0, msg: Non-numeric ser
ver-side value for incr or decr – db.(*sequenceAllocator).lastSequence() at sequence_allocator.go:34
12:47:26.294198 HTTP: #022: --> 502 Non-numeric server-side value for incr or decr (DELTA_BADVAL) (189.5 ms)

{“error”:“Bad Gateway”,“reason”:“Non-numeric server-side value for incr or decr (DELTA_BADVAL)”}

And when doing it again the database is created successfully.

Anyway… after restarting the sync gateway this bucket is lost. data/sync_gateway.walrus does not mention “new-bucket” anywhere. Even if change the database to save to data/, it will not be loaded after restart.

So whats wrong?


The following Json:

"server": ""

is used to create a new database on a Couchbase server accessible on

If you want to use walrus, you should replace it by

"server" : "walrus:data"