Couchbase\DurabilityException: LCB_ERR_DURABILITY_AMBIGUOUS

Hello,

I am getting this error and I don’t know what is the problem. Can please somebody help me identify the problem?

Couchbase\DurabilityException: LCB_ERR_DURABILITY_AMBIGUOUS

I used it like this in my code

	static function insertDocument ($documentKey, $documentValue, $bucketName, $objCbOptions = array())
{

	/*
	 $objCbOptions = array (
							'expirySeconds' => <int>,
							'timeoutSeconds' => <int>,
							'durabilityLevel' => None = 0; Majority = 1; MajorityAndPersistActive = 2; PersistToMajority = 3
						)
	 */
			$opts = null;
	if (!empty($objCbOptions)) {
		$opts = new \Couchbase\InsertOptions();
		if (!empty($objCbOptions['expirySeconds'])) {
			$opts->expiry($objCbOptions['expirySeconds']);//in documentation is written milliseconds, but in reality it seems to be seconds
		}
		if (!empty($objCbOptions['timeoutSeconds'])) {
			$opts->timeout($objCbOptions['timeoutSeconds']);//in documentation is written milliseconds, but in reality it seems to be seconds
		}
		if (!empty($objCbOptions['durabilityLevel'])) {
			$opts->durabilityLevel($objCbOptions['durabilityLevel']);
		}
	}

	return CouchbaseClient::getCollection($bucketName)->insert($documentKey, $documentValue, $opts);

Hi @flaviu

This error indicates that the server was unable to become certain about the result of the operation, within the specified timeout.

Ambiguity is unavoidable in any system, particularly a distributed one - a classic example (though not one that would provoke this particular error code) is if the server successfully completes the mutation but then the network fails just before it can return success, leaving the result ambiguous.

Please see the documentation on ambiguity here for more - https://docs.couchbase.com/java-sdk/3.0/howtos/error-handling.html#ambiguity