Sync Gateway error "Create index cannot proceed due to presence of duplicate index name"

Hi,

We have one node Couchbase environment with a Sync Gateway for mobile applications.

We are seeing the below error periodically when our mobile applications try to connect to the database via Syncgateway and sync with it.

“2021-09-11T13:54:07.361+04:30 [ERR] Error opening database dialysiscloud_prod: Unable to install index channels: Error installing Couchbase index: sg_channels_x1: Error creating index with statement: CREATE INDEX sg_channels_x1 ON dialysiscloud_prod(ALL (ARRAY [op.name, LEAST(meta().xattrs._sync.sequence,op.val.seq), IFMISSING(op.val.rev,null), IFMISSING(op.val.del,null)] FOR op IN OBJECT_PAIRS(meta().xattrs._sync.channels) END), meta().xattrs._sync.rev, meta().xattrs._sync.sequence, meta().xattrs._sync.flags) with {“retain_deleted_xattr”:true,“defer_build”:true}. Error: [5000] GSI CreateIndex() - cause: Index creation for index sg_channels_x1, bucket dialysiscloud_prod, scope _default, collection _default cannot start. Reason: Create index cannot proceed due to presence of duplicate index name… – rest.RunServer() at config.go:1086”.

Why does this is happening? and is there a way to detect and delete duplicate indexes?

Hi Moriz12,

Sorry for the delayed reply. Sync Gateway should only attempt to create an index if an existing one does not exist.

Could you please confirm:
when this happens? You say it happens when mobile applications try to connect to Sync Gateway however Sync Gateway should only attempt to create the indexes on startup
what version of Sync Gateway you are on?

Thanks