<p dir="auto">I posted this issue in the <code class="notranslate">neo4j/neo4j-go-driver</code> repository a couple weeks ago, but got no reply, so I am posting it here now. I have been experiencing this issue for the entire time, and I have no workarounds. Any help would be greatly appreciated.</p>
<p dir="auto"><strong>Neo4j Version:</strong> 3.5.9 Community<br>
<strong>Neo4j Mode</strong>: Single instance<br>
<strong>Driver version</strong>: Newest stable version (just updated with <code class="notranslate">go get -u</code>)<br>
<strong>Operating System:</strong> MacOS Mojave 10.14.5</p>
<p dir="auto">Multiple different Neo4j instances have been targeted, all of which yield the same results.</p>
<h3 dir="auto">Steps to reproduce</h3>
<ol dir="auto">
<li>Start Neo4j locally</li>
<li>Run the snippet shown below</li>
</ol>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">The second CREATE query panic()s because Session.Run() returns an error due to the conflict coming from a duplicate (:Client).name.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">The program completes with an exit code of 0.<br>
The driver debug logs display the error that we are attempting to catch, but it is not returned from Session.Run().</p>
<p dir="auto">The code snippet in question:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="package main

import (
	&quot;github.com/neo4j/neo4j-go-driver/neo4j&quot;
)

func main() {
	driver, err := neo4j.NewDriver(&quot;bolt://localhost:7687&quot;, neo4j.BasicAuth(&quot;neo4j&quot;, &quot;graph&quot;, &quot;&quot;), func(config *neo4j.Config) {
		config.Log = neo4j.ConsoleLogger(neo4j.DEBUG)
	})
	if err != nil {
		panic(err)
	}
	session, err := driver.Session(neo4j.AccessModeWrite)
	if err != nil {
		panic(err)
	}
	defer session.Close()
	params := map[string]interface{}{&quot;name&quot;: &quot;ABC&quot;}

	// Deletes the client if it exists
	if _, err = session.Run(`MATCH (c:Client {name: {name}}) DELETE c`, params); err != nil {
		panic(err)
	}

	// Create the constraint
	if _, err = session.Run(`CREATE CONSTRAINT ON (c:Client) ASSERT c.name IS UNIQUE`, nil); err != nil {
		panic(err)
	}
	// Creates the client
	if _, err = session.Run(`CREATE (:Client {name: {name}})`, params); err != nil {
		panic(err)
	}
	// Should panic with an error due to a conflict.
	if _, err = session.Run(`CREATE (:Client {name: {name}})`, params); err != nil {
		panic(err)
	}
}"><pre class="notranslate"><code class="notranslate">package main

import (
	"github.com/neo4j/neo4j-go-driver/neo4j"
)

func main() {
	driver, err := neo4j.NewDriver("bolt://localhost:7687", neo4j.BasicAuth("neo4j", "graph", ""), func(config *neo4j.Config) {
		config.Log = neo4j.ConsoleLogger(neo4j.DEBUG)
	})
	if err != nil {
		panic(err)
	}
	session, err := driver.Session(neo4j.AccessModeWrite)
	if err != nil {
		panic(err)
	}
	defer session.Close()
	params := map[string]interface{}{"name": "ABC"}

	// Deletes the client if it exists
	if _, err = session.Run(`MATCH (c:Client {name: {name}}) DELETE c`, params); err != nil {
		panic(err)
	}

	// Create the constraint
	if _, err = session.Run(`CREATE CONSTRAINT ON (c:Client) ASSERT c.name IS UNIQUE`, nil); err != nil {
		panic(err)
	}
	// Creates the client
	if _, err = session.Run(`CREATE (:Client {name: {name}})`, params); err != nil {
		panic(err)
	}
	// Should panic with an error due to a conflict.
	if _, err = session.Run(`CREATE (:Client {name: {name}})`, params); err != nil {
		panic(err)
	}
}
</code></pre></div>
<p dir="auto">I receive the following in my terminal as output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INFO   : 2019/12/18 15:04:11.068354 [connector]: Version 1.7.4 [6912093]
INFO   : 2019/12/18 15:04:11.068599 [pool-1]: Creating pool towards localhost:7687
INFO   : 2019/12/18 15:04:11.077521 [pool-1]: Acquiring connection from the pool towards localhost:7687
INFO   : 2019/12/18 15:04:11.077570 [addr]: Resolving address localhost:7687
INFO   : 2019/12/18 15:04:11.079483 [addr]: Host resolved to 2 IP addresses
INFO   : 2019/12/18 15:04:11.079528 [conn-1]: Opening IPv6 connection to ::1 at port 7687
INFO   : 2019/12/18 15:04:11.079724 [conn-1]: Opening IPv4 connection to 127.0.0.1 at port 7687
WARNING: 2019/12/18 15:04:11.089965 [conn-1]: Openssl reported error 'self signed certificate' with code '18' when establishing trust, but resuming handshake since trust verification is set to be skipped
DEBUG  : 2019/12/18 15:04:11.090271 [conn-1]: Openssl established trust
INFO   : 2019/12/18 15:04:11.093920 [conn-1]: Remote endpoint is 127.0.0.1:7687
INFO   : 2019/12/18 15:04:11.093936 [conn-1]: Local endpoint is 127.0.0.1:62676
INFO   : 2019/12/18 15:04:11.093989 [conn-1]: Performing handshake
INFO   : 2019/12/18 15:04:11.094008 [conn-1]: (Sent 20 of 20 bytes)
INFO   : 2019/12/18 15:04:11.094581 [conn-1]: Received 4 of 4 bytes
INFO   : 2019/12/18 15:04:11.094594 [conn-1]: &lt;SET protocol_version=3&gt;
INFO   : 2019/12/18 15:04:11.094625 [conn-1]: &lt;CONNECTED&gt;
INFO   : 2019/12/18 15:04:11.094633 [conn-1]: Initialising connection
DEBUG  : 2019/12/18 15:04:11.094654 [conn-1]: C[0] HELLO [{scheme: basic, principal: neo4j, credentials: ********, user_agent: Go Driver/1.7}]
INFO   : 2019/12/18 15:04:11.094688 [conn-1]: (Sent 79 of 79 bytes)
INFO   : 2019/12/18 15:04:11.095526 [conn-1]: Received 48 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.095556 [conn-1]: S[0] SUCCESS [{server: Neo4j/3.5.9, connection_id: bolt-19}]
INFO   : 2019/12/18 15:04:11.095560 [conn-1]: &lt;SET server=&quot;Neo4j/3.5.9&quot;&gt;
INFO   : 2019/12/18 15:04:11.095566 [conn-1, bolt-19]: &lt;SET connection_id=&quot;bolt-19&quot;&gt;
INFO   : 2019/12/18 15:04:11.095570 [conn-1, bolt-19]: &lt;READY&gt;
DEBUG  : 2019/12/18 15:04:11.095693 [conn-1, bolt-19]: C[1] RUN [MATCH (c:Client {name: {name}}) DELETE c, {name: ABC}, {}]
DEBUG  : 2019/12/18 15:04:11.095707 [conn-1, bolt-19]: C[2] PULL_ALL []
INFO   : 2019/12/18 15:04:11.095730 [conn-1, bolt-19]: (Sent 65 of 65 bytes)
INFO   : 2019/12/18 15:04:11.106007 [conn-1, bolt-19]: Received 102 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.106032 [conn-1, bolt-19]: S[1] SUCCESS [{t_first: 7, fields: []}]
DEBUG  : 2019/12/18 15:04:11.106038 [conn-1, bolt-19]: &lt;SET result_field_names=[]&gt;
DEBUG  : 2019/12/18 15:04:11.106118 [conn-1, bolt-19]: S[2] SUCCESS [{bookmark: neo4j:bookmark:v1:tx488, stats: {nodes-deleted: 1}, type: w, t_last: 0}]
INFO   : 2019/12/18 15:04:11.106126 [conn-1, bolt-19]: &lt;SET last_bookmark=&quot;neo4j:bookmark:v1:tx488&quot;&gt;
INFO   : 2019/12/18 15:04:11.106151 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.106162 [conn-1, bolt-19]: C[3] RESET []
INFO   : 2019/12/18 15:04:11.106216 [conn-1, bolt-19]: (Sent 6 of 6 bytes)
INFO   : 2019/12/18 15:04:11.106636 [conn-1, bolt-19]: Received 7 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.106652 [conn-1, bolt-19]: S[3] SUCCESS [{}]
INFO   : 2019/12/18 15:04:11.106701 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.106733 [conn-1, bolt-19]: C[4] RUN [CREATE CONSTRAINT ON (c:Client) ASSERT c.name IS UNIQUE, {}, {}]
DEBUG  : 2019/12/18 15:04:11.106745 [conn-1, bolt-19]: C[5] PULL_ALL []
INFO   : 2019/12/18 15:04:11.106765 [conn-1, bolt-19]: (Sent 71 of 71 bytes)
INFO   : 2019/12/18 15:04:11.310320 [conn-1, bolt-19]: Received 109 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.310361 [conn-1, bolt-19]: S[4] SUCCESS [{t_first: 201, fields: []}]
DEBUG  : 2019/12/18 15:04:11.310370 [conn-1, bolt-19]: &lt;SET result_field_names=[]&gt;
DEBUG  : 2019/12/18 15:04:11.310409 [conn-1, bolt-19]: S[5] SUCCESS [{bookmark: neo4j:bookmark:v1:tx490, stats: {constraints-added: 1}, type: s, t_last: 0}]
INFO   : 2019/12/18 15:04:11.310415 [conn-1, bolt-19]: &lt;SET last_bookmark=&quot;neo4j:bookmark:v1:tx490&quot;&gt;
INFO   : 2019/12/18 15:04:11.310435 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.310442 [conn-1, bolt-19]: C[6] RESET []
INFO   : 2019/12/18 15:04:11.310461 [conn-1, bolt-19]: (Sent 6 of 6 bytes)
INFO   : 2019/12/18 15:04:11.311240 [conn-1, bolt-19]: Received 7 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.311295 [conn-1, bolt-19]: S[6] SUCCESS [{}]
INFO   : 2019/12/18 15:04:11.311361 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.311422 [conn-1, bolt-19]: C[7] RUN [CREATE (:Client {name: {name}}), {name: ABC}, {}]
DEBUG  : 2019/12/18 15:04:11.311464 [conn-1, bolt-19]: C[8] PULL_ALL []
INFO   : 2019/12/18 15:04:11.311533 [conn-1, bolt-19]: (Sent 56 of 56 bytes)
INFO   : 2019/12/18 15:04:11.318996 [conn-1, bolt-19]: Received 132 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.319022 [conn-1, bolt-19]: S[7] SUCCESS [{t_first: 6, fields: []}]
DEBUG  : 2019/12/18 15:04:11.319030 [conn-1, bolt-19]: &lt;SET result_field_names=[]&gt;
DEBUG  : 2019/12/18 15:04:11.319087 [conn-1, bolt-19]: S[8] SUCCESS [{bookmark: neo4j:bookmark:v1:tx491, stats: {labels-added: 1, nodes-created: 1, properties-set: 1}, type: w, t_last: 0}]
INFO   : 2019/12/18 15:04:11.319094 [conn-1, bolt-19]: &lt;SET last_bookmark=&quot;neo4j:bookmark:v1:tx491&quot;&gt;
INFO   : 2019/12/18 15:04:11.319118 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.319127 [conn-1, bolt-19]: C[9] RESET []
INFO   : 2019/12/18 15:04:11.319148 [conn-1, bolt-19]: (Sent 6 of 6 bytes)
INFO   : 2019/12/18 15:04:11.319585 [conn-1, bolt-19]: Received 7 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.319600 [conn-1, bolt-19]: S[9] SUCCESS [{}]
INFO   : 2019/12/18 15:04:11.319628 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.319672 [conn-1, bolt-19]: C[10] RUN [CREATE (:Client {name: {name}}), {name: ABC}, {}]
DEBUG  : 2019/12/18 15:04:11.319689 [conn-1, bolt-19]: C[11] PULL_ALL []
INFO   : 2019/12/18 15:04:11.319717 [conn-1, bolt-19]: (Sent 56 of 56 bytes)
INFO   : 2019/12/18 15:04:11.321409 [conn-1, bolt-19]: Received 150 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.321443 [conn-1, bolt-19]: S[10] FAILURE [{code: Neo.ClientError.Schema.ConstraintValidationFailed, message: Node(98) already exists with label `Client` and property `name` = 'ABC'}]
DEBUG  : 2019/12/18 15:04:11.321450 [conn-1, bolt-19]: &lt;FAILURE code=&quot;Neo.ClientError.Schema.ConstraintValidationFailed&quot;&gt;
DEBUG  : 2019/12/18 15:04:11.321453 [conn-1, bolt-19]: &lt;FAILURE message=&quot;Node(98) already exists with label `Client` and property `name` = 'ABC'&quot;&gt;
INFO   : 2019/12/18 15:04:11.321459 [conn-1, bolt-19]: &lt;FAILED&gt; [BoltConnection_fetch(/Users/neo/buildAgent/work/c4f1f1576663d58b/seabolt/src/seabolt/src/bolt/connection.c:353), failure message]
DEBUG  : 2019/12/18 15:04:11.321512 [conn-1, bolt-19]: S[11] IGNORED []
INFO   : 2019/12/18 15:04:11.321526 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.321532 [conn-1, bolt-19]: C[12] RESET []
INFO   : 2019/12/18 15:04:11.321548 [conn-1, bolt-19]: (Sent 6 of 6 bytes)
INFO   : 2019/12/18 15:04:11.322035 [conn-1, bolt-19]: Received 7 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.322049 [conn-1, bolt-19]: S[12] SUCCESS [{}]
INFO   : 2019/12/18 15:04:11.322057 [conn-1, bolt-19]: &lt;READY&gt;

Process finished with exit code 0"><pre class="notranslate"><code class="notranslate">INFO   : 2019/12/18 15:04:11.068354 [connector]: Version 1.7.4 [6912093]
INFO   : 2019/12/18 15:04:11.068599 [pool-1]: Creating pool towards localhost:7687
INFO   : 2019/12/18 15:04:11.077521 [pool-1]: Acquiring connection from the pool towards localhost:7687
INFO   : 2019/12/18 15:04:11.077570 [addr]: Resolving address localhost:7687
INFO   : 2019/12/18 15:04:11.079483 [addr]: Host resolved to 2 IP addresses
INFO   : 2019/12/18 15:04:11.079528 [conn-1]: Opening IPv6 connection to ::1 at port 7687
INFO   : 2019/12/18 15:04:11.079724 [conn-1]: Opening IPv4 connection to 127.0.0.1 at port 7687
WARNING: 2019/12/18 15:04:11.089965 [conn-1]: Openssl reported error 'self signed certificate' with code '18' when establishing trust, but resuming handshake since trust verification is set to be skipped
DEBUG  : 2019/12/18 15:04:11.090271 [conn-1]: Openssl established trust
INFO   : 2019/12/18 15:04:11.093920 [conn-1]: Remote endpoint is 127.0.0.1:7687
INFO   : 2019/12/18 15:04:11.093936 [conn-1]: Local endpoint is 127.0.0.1:62676
INFO   : 2019/12/18 15:04:11.093989 [conn-1]: Performing handshake
INFO   : 2019/12/18 15:04:11.094008 [conn-1]: (Sent 20 of 20 bytes)
INFO   : 2019/12/18 15:04:11.094581 [conn-1]: Received 4 of 4 bytes
INFO   : 2019/12/18 15:04:11.094594 [conn-1]: &lt;SET protocol_version=3&gt;
INFO   : 2019/12/18 15:04:11.094625 [conn-1]: &lt;CONNECTED&gt;
INFO   : 2019/12/18 15:04:11.094633 [conn-1]: Initialising connection
DEBUG  : 2019/12/18 15:04:11.094654 [conn-1]: C[0] HELLO [{scheme: basic, principal: neo4j, credentials: ********, user_agent: Go Driver/1.7}]
INFO   : 2019/12/18 15:04:11.094688 [conn-1]: (Sent 79 of 79 bytes)
INFO   : 2019/12/18 15:04:11.095526 [conn-1]: Received 48 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.095556 [conn-1]: S[0] SUCCESS [{server: Neo4j/3.5.9, connection_id: bolt-19}]
INFO   : 2019/12/18 15:04:11.095560 [conn-1]: &lt;SET server="Neo4j/3.5.9"&gt;
INFO   : 2019/12/18 15:04:11.095566 [conn-1, bolt-19]: &lt;SET connection_id="bolt-19"&gt;
INFO   : 2019/12/18 15:04:11.095570 [conn-1, bolt-19]: &lt;READY&gt;
DEBUG  : 2019/12/18 15:04:11.095693 [conn-1, bolt-19]: C[1] RUN [MATCH (c:Client {name: {name}}) DELETE c, {name: ABC}, {}]
DEBUG  : 2019/12/18 15:04:11.095707 [conn-1, bolt-19]: C[2] PULL_ALL []
INFO   : 2019/12/18 15:04:11.095730 [conn-1, bolt-19]: (Sent 65 of 65 bytes)
INFO   : 2019/12/18 15:04:11.106007 [conn-1, bolt-19]: Received 102 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.106032 [conn-1, bolt-19]: S[1] SUCCESS [{t_first: 7, fields: []}]
DEBUG  : 2019/12/18 15:04:11.106038 [conn-1, bolt-19]: &lt;SET result_field_names=[]&gt;
DEBUG  : 2019/12/18 15:04:11.106118 [conn-1, bolt-19]: S[2] SUCCESS [{bookmark: neo4j:bookmark:v1:tx488, stats: {nodes-deleted: 1}, type: w, t_last: 0}]
INFO   : 2019/12/18 15:04:11.106126 [conn-1, bolt-19]: &lt;SET last_bookmark="neo4j:bookmark:v1:tx488"&gt;
INFO   : 2019/12/18 15:04:11.106151 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.106162 [conn-1, bolt-19]: C[3] RESET []
INFO   : 2019/12/18 15:04:11.106216 [conn-1, bolt-19]: (Sent 6 of 6 bytes)
INFO   : 2019/12/18 15:04:11.106636 [conn-1, bolt-19]: Received 7 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.106652 [conn-1, bolt-19]: S[3] SUCCESS [{}]
INFO   : 2019/12/18 15:04:11.106701 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.106733 [conn-1, bolt-19]: C[4] RUN [CREATE CONSTRAINT ON (c:Client) ASSERT c.name IS UNIQUE, {}, {}]
DEBUG  : 2019/12/18 15:04:11.106745 [conn-1, bolt-19]: C[5] PULL_ALL []
INFO   : 2019/12/18 15:04:11.106765 [conn-1, bolt-19]: (Sent 71 of 71 bytes)
INFO   : 2019/12/18 15:04:11.310320 [conn-1, bolt-19]: Received 109 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.310361 [conn-1, bolt-19]: S[4] SUCCESS [{t_first: 201, fields: []}]
DEBUG  : 2019/12/18 15:04:11.310370 [conn-1, bolt-19]: &lt;SET result_field_names=[]&gt;
DEBUG  : 2019/12/18 15:04:11.310409 [conn-1, bolt-19]: S[5] SUCCESS [{bookmark: neo4j:bookmark:v1:tx490, stats: {constraints-added: 1}, type: s, t_last: 0}]
INFO   : 2019/12/18 15:04:11.310415 [conn-1, bolt-19]: &lt;SET last_bookmark="neo4j:bookmark:v1:tx490"&gt;
INFO   : 2019/12/18 15:04:11.310435 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.310442 [conn-1, bolt-19]: C[6] RESET []
INFO   : 2019/12/18 15:04:11.310461 [conn-1, bolt-19]: (Sent 6 of 6 bytes)
INFO   : 2019/12/18 15:04:11.311240 [conn-1, bolt-19]: Received 7 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.311295 [conn-1, bolt-19]: S[6] SUCCESS [{}]
INFO   : 2019/12/18 15:04:11.311361 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.311422 [conn-1, bolt-19]: C[7] RUN [CREATE (:Client {name: {name}}), {name: ABC}, {}]
DEBUG  : 2019/12/18 15:04:11.311464 [conn-1, bolt-19]: C[8] PULL_ALL []
INFO   : 2019/12/18 15:04:11.311533 [conn-1, bolt-19]: (Sent 56 of 56 bytes)
INFO   : 2019/12/18 15:04:11.318996 [conn-1, bolt-19]: Received 132 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.319022 [conn-1, bolt-19]: S[7] SUCCESS [{t_first: 6, fields: []}]
DEBUG  : 2019/12/18 15:04:11.319030 [conn-1, bolt-19]: &lt;SET result_field_names=[]&gt;
DEBUG  : 2019/12/18 15:04:11.319087 [conn-1, bolt-19]: S[8] SUCCESS [{bookmark: neo4j:bookmark:v1:tx491, stats: {labels-added: 1, nodes-created: 1, properties-set: 1}, type: w, t_last: 0}]
INFO   : 2019/12/18 15:04:11.319094 [conn-1, bolt-19]: &lt;SET last_bookmark="neo4j:bookmark:v1:tx491"&gt;
INFO   : 2019/12/18 15:04:11.319118 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.319127 [conn-1, bolt-19]: C[9] RESET []
INFO   : 2019/12/18 15:04:11.319148 [conn-1, bolt-19]: (Sent 6 of 6 bytes)
INFO   : 2019/12/18 15:04:11.319585 [conn-1, bolt-19]: Received 7 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.319600 [conn-1, bolt-19]: S[9] SUCCESS [{}]
INFO   : 2019/12/18 15:04:11.319628 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.319672 [conn-1, bolt-19]: C[10] RUN [CREATE (:Client {name: {name}}), {name: ABC}, {}]
DEBUG  : 2019/12/18 15:04:11.319689 [conn-1, bolt-19]: C[11] PULL_ALL []
INFO   : 2019/12/18 15:04:11.319717 [conn-1, bolt-19]: (Sent 56 of 56 bytes)
INFO   : 2019/12/18 15:04:11.321409 [conn-1, bolt-19]: Received 150 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.321443 [conn-1, bolt-19]: S[10] FAILURE [{code: Neo.ClientError.Schema.ConstraintValidationFailed, message: Node(98) already exists with label `Client` and property `name` = 'ABC'}]
DEBUG  : 2019/12/18 15:04:11.321450 [conn-1, bolt-19]: &lt;FAILURE code="Neo.ClientError.Schema.ConstraintValidationFailed"&gt;
DEBUG  : 2019/12/18 15:04:11.321453 [conn-1, bolt-19]: &lt;FAILURE message="Node(98) already exists with label `Client` and property `name` = 'ABC'"&gt;
INFO   : 2019/12/18 15:04:11.321459 [conn-1, bolt-19]: &lt;FAILED&gt; [BoltConnection_fetch(/Users/neo/buildAgent/work/c4f1f1576663d58b/seabolt/src/seabolt/src/bolt/connection.c:353), failure message]
DEBUG  : 2019/12/18 15:04:11.321512 [conn-1, bolt-19]: S[11] IGNORED []
INFO   : 2019/12/18 15:04:11.321526 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/12/18 15:04:11.321532 [conn-1, bolt-19]: C[12] RESET []
INFO   : 2019/12/18 15:04:11.321548 [conn-1, bolt-19]: (Sent 6 of 6 bytes)
INFO   : 2019/12/18 15:04:11.322035 [conn-1, bolt-19]: Received 7 of 2..8192 bytes
DEBUG  : 2019/12/18 15:04:11.322049 [conn-1, bolt-19]: S[12] SUCCESS [{}]
INFO   : 2019/12/18 15:04:11.322057 [conn-1, bolt-19]: &lt;READY&gt;

Process finished with exit code 0
</code></pre></div>
<p dir="auto"><strong>Neo4j Version:</strong> 3.5.9 Community<br>
<strong>Neo4j Mode</strong>: Single instance<br>
<strong>Driver version</strong>: Newest stable version (just updated with <code class="notranslate">go get -u</code>)<br>
<strong>Operating System:</strong> MacOS Mojave 10.14.5</p>
<p dir="auto">My goal is to build a function <code class="notranslate">Run</code> which follows the type <code class="notranslate">RunFunc</code> in the code snippet to allow for my queries to call the function whether they are in a transaction or just using a session. I am experiencing an issue when trying to create the Session using the Driver inside <code class="notranslate">Run</code> just before running the query. If I create the Session outside of the function first, then there are no issues. This seems very perplexing to me. I am moving on with a workaround for now, but any help would be appreciated. Thanks.</p>
<p dir="auto">EDIT: The problem gets worse. See the other EDIT section near the bottom</p>
<h3 dir="auto">Steps to reproduce</h3>
<ol dir="auto">
<li>Start Neo4j locally</li>
<li>Create the <code class="notranslate">runner</code> function variable as shown in the snippets below,</li>
<li>Run a query with syntax errors using <code class="notranslate">runner</code></li>
<li>Observe the results between the two different snippets.</li>
</ol>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Both <code class="notranslate">Case 1</code> and <code class="notranslate">Case 2</code> produce errors indicating that there are syntax errors in the queries.<br>
I am running a <code class="notranslate">panic()</code> when the error is not <code class="notranslate">nil</code>, so the program should be producing a stack trace showing the error, and it should be exiting with non 0 exit status.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">In <code class="notranslate">Case 1</code>, there are no errors, but the debug logs do indicate that the errors were found.<br>
In <code class="notranslate">Case 2</code>, the errors show up as expected.</p>
<p dir="auto"><code class="notranslate">Case 1</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="	var runner neo4jdb.RunFunc = func(cypher string, params map[string]interface{}) (neo4j.Result, error) {
		var s neo4j.Session
		s, err = neo4jdb.Driver.Session(neo4j.AccessModeWrite)
		if err != nil {
			panic(err)
		}
		defer s.Close()
		return s.Run(cypher, params)
	}"><pre class="notranslate"><code class="notranslate">	var runner neo4jdb.RunFunc = func(cypher string, params map[string]interface{}) (neo4j.Result, error) {
		var s neo4j.Session
		s, err = neo4jdb.Driver.Session(neo4j.AccessModeWrite)
		if err != nil {
			panic(err)
		}
		defer s.Close()
		return s.Run(cypher, params)
	}
</code></pre></div>
<p dir="auto"><code class="notranslate">Case 2</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="	var s neo4j.Session
	s, err = neo4jdb.Driver.Session(neo4j.AccessModeWrite)
	if err != nil {
		panic(err)
	}
	defer s.Close()
	var runner neo4jdb.RunFunc = func(cypher string, params map[string]interface{}) (neo4j.Result, error) {
		return s.Run(cypher, params)
	}"><pre class="notranslate"><code class="notranslate">	var s neo4j.Session
	s, err = neo4jdb.Driver.Session(neo4j.AccessModeWrite)
	if err != nil {
		panic(err)
	}
	defer s.Close()
	var runner neo4jdb.RunFunc = func(cypher string, params map[string]interface{}) (neo4j.Result, error) {
		return s.Run(cypher, params)
	}
</code></pre></div>
<p dir="auto">Here are the debug logs from when errors are not returned:<br>
(I have replaced my actual queries with <code class="notranslate">...</code>, but the ones in question have a syntax error with FOREACH)</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="(more logs above)
2019/11/22 15:52:11 Session() &amp;{0xc0003b72c0 0 []  1 &lt;nil&gt; &lt;nil&gt;} &lt;nil&gt;
INFO   : 2019/11/22 15:52:11.023738 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/11/22 15:52:11.023811 [conn-1, bolt-90]: C[64] RUN [
...]
DEBUG  : 2019/11/22 15:52:11.023828 [conn-1, bolt-90]: C[65] PULL_ALL []
INFO   : 2019/11/22 15:52:11.023857 [conn-1, bolt-90]: (Sent 504 of 504 bytes)
2019/11/22 15:52:11 Run() &amp;{[] [] &lt;nil&gt; 0xc0003cc380 0xc0003cc280 &lt;nil&gt; 64 false 65 false} &lt;nil&gt;
INFO   : 2019/11/22 15:52:11.030226 [conn-1, bolt-90]: Received 188 of 2..8192 bytes
DEBUG  : 2019/11/22 15:52:11.030249 [conn-1, bolt-90]: S[64] FAILURE [{code: Neo.ClientError.Statement.SyntaxError, message: Unexpected end of input: expected whitespace, comment or IN (line 8, column 12 (offset: 325))
&quot;FOREACH (k &quot;
            ^}]
DEBUG  : 2019/11/22 15:52:11.030256 [conn-1, bolt-90]: &lt;FAILURE code=&quot;Neo.ClientError.Statement.SyntaxError&quot;&gt;
DEBUG  : 2019/11/22 15:52:11.030261 [conn-1, bolt-90]: &lt;FAILURE message=&quot;Unexpected end of input: expected whitespace, comment or IN (line 8, column 12 (offset: 325))
&quot;FOREACH (k &quot;
            ^&quot;&gt;
INFO   : 2019/11/22 15:52:11.030266 [conn-1, bolt-90]: &lt;FAILED&gt; [BoltConnection_fetch(/Users/neo/buildAgent/work/c4f1f1576663d58b/seabolt/src/seabolt/src/bolt/connection.c:353), failure message]
DEBUG  : 2019/11/22 15:52:11.030307 [conn-1, bolt-90]: S[65] IGNORED []
INFO   : 2019/11/22 15:52:11.030328 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/11/22 15:52:11.030340 [conn-1, bolt-90]: C[66] RESET []
INFO   : 2019/11/22 15:52:11.030367 [conn-1, bolt-90]: (Sent 6 of 6 bytes)
INFO   : 2019/11/22 15:52:11.030691 [conn-1, bolt-90]: Received 7 of 2..8192 bytes
DEBUG  : 2019/11/22 15:52:11.030707 [conn-1, bolt-90]: S[66] SUCCESS [{}]
INFO   : 2019/11/22 15:52:11.030712 [conn-1, bolt-90]: &lt;READY&gt;
2019/11/22 15:52:11 Session() &amp;{0xc0003b72c0 0 []  1 &lt;nil&gt; &lt;nil&gt;} &lt;nil&gt;
INFO   : 2019/11/22 15:52:11.030758 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/11/22 15:52:11.030841 [conn-1, bolt-90]: C[67] RUN [
...]
DEBUG  : 2019/11/22 15:52:11.030859 [conn-1, bolt-90]: C[68] PULL_ALL []
INFO   : 2019/11/22 15:52:11.030886 [conn-1, bolt-90]: (Sent 642 of 642 bytes)
2019/11/22 15:52:11 Run() &amp;{[] [] &lt;nil&gt; 0xc0003cc500 0xc000291780 &lt;nil&gt; 67 false 68 false} &lt;nil&gt;
INFO   : 2019/11/22 15:52:11.035301 [conn-1, bolt-90]: Received 188 of 2..8192 bytes
DEBUG  : 2019/11/22 15:52:11.035324 [conn-1, bolt-90]: S[67] FAILURE [{code: Neo.ClientError.Statement.SyntaxError, message: Unexpected end of input: expected whitespace, comment or IN (line 8, column 12 (offset: 325))
&quot;FOREACH (k &quot;
            ^}]
DEBUG  : 2019/11/22 15:52:11.035332 [conn-1, bolt-90]: &lt;FAILURE code=&quot;Neo.ClientError.Statement.SyntaxError&quot;&gt;
DEBUG  : 2019/11/22 15:52:11.035337 [conn-1, bolt-90]: &lt;FAILURE message=&quot;Unexpected end of input: expected whitespace, comment or IN (line 8, column 12 (offset: 325))
&quot;FOREACH (k &quot;
            ^&quot;&gt;
INFO   : 2019/11/22 15:52:11.035341 [conn-1, bolt-90]: &lt;FAILED&gt; [BoltConnection_fetch(/Users/neo/buildAgent/work/c4f1f1576663d58b/seabolt/src/seabolt/src/bolt/connection.c:353), failure message]
DEBUG  : 2019/11/22 15:52:11.035379 [conn-1, bolt-90]: S[68] IGNORED []
INFO   : 2019/11/22 15:52:11.035396 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/11/22 15:52:11.035406 [conn-1, bolt-90]: C[69] RESET []
INFO   : 2019/11/22 15:52:11.035427 [conn-1, bolt-90]: (Sent 6 of 6 bytes)
INFO   : 2019/11/22 15:52:11.035746 [conn-1, bolt-90]: Received 7 of 2..8192 bytes
DEBUG  : 2019/11/22 15:52:11.035761 [conn-1, bolt-90]: S[69] SUCCESS [{}]
INFO   : 2019/11/22 15:52:11.035766 [conn-1, bolt-90]: &lt;READY&gt;

Process finished with exit code 0"><pre class="notranslate"><code class="notranslate">(more logs above)
2019/11/22 15:52:11 Session() &amp;{0xc0003b72c0 0 []  1 &lt;nil&gt; &lt;nil&gt;} &lt;nil&gt;
INFO   : 2019/11/22 15:52:11.023738 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/11/22 15:52:11.023811 [conn-1, bolt-90]: C[64] RUN [
...]
DEBUG  : 2019/11/22 15:52:11.023828 [conn-1, bolt-90]: C[65] PULL_ALL []
INFO   : 2019/11/22 15:52:11.023857 [conn-1, bolt-90]: (Sent 504 of 504 bytes)
2019/11/22 15:52:11 Run() &amp;{[] [] &lt;nil&gt; 0xc0003cc380 0xc0003cc280 &lt;nil&gt; 64 false 65 false} &lt;nil&gt;
INFO   : 2019/11/22 15:52:11.030226 [conn-1, bolt-90]: Received 188 of 2..8192 bytes
DEBUG  : 2019/11/22 15:52:11.030249 [conn-1, bolt-90]: S[64] FAILURE [{code: Neo.ClientError.Statement.SyntaxError, message: Unexpected end of input: expected whitespace, comment or IN (line 8, column 12 (offset: 325))
"FOREACH (k "
            ^}]
DEBUG  : 2019/11/22 15:52:11.030256 [conn-1, bolt-90]: &lt;FAILURE code="Neo.ClientError.Statement.SyntaxError"&gt;
DEBUG  : 2019/11/22 15:52:11.030261 [conn-1, bolt-90]: &lt;FAILURE message="Unexpected end of input: expected whitespace, comment or IN (line 8, column 12 (offset: 325))
"FOREACH (k "
            ^"&gt;
INFO   : 2019/11/22 15:52:11.030266 [conn-1, bolt-90]: &lt;FAILED&gt; [BoltConnection_fetch(/Users/neo/buildAgent/work/c4f1f1576663d58b/seabolt/src/seabolt/src/bolt/connection.c:353), failure message]
DEBUG  : 2019/11/22 15:52:11.030307 [conn-1, bolt-90]: S[65] IGNORED []
INFO   : 2019/11/22 15:52:11.030328 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/11/22 15:52:11.030340 [conn-1, bolt-90]: C[66] RESET []
INFO   : 2019/11/22 15:52:11.030367 [conn-1, bolt-90]: (Sent 6 of 6 bytes)
INFO   : 2019/11/22 15:52:11.030691 [conn-1, bolt-90]: Received 7 of 2..8192 bytes
DEBUG  : 2019/11/22 15:52:11.030707 [conn-1, bolt-90]: S[66] SUCCESS [{}]
INFO   : 2019/11/22 15:52:11.030712 [conn-1, bolt-90]: &lt;READY&gt;
2019/11/22 15:52:11 Session() &amp;{0xc0003b72c0 0 []  1 &lt;nil&gt; &lt;nil&gt;} &lt;nil&gt;
INFO   : 2019/11/22 15:52:11.030758 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/11/22 15:52:11.030841 [conn-1, bolt-90]: C[67] RUN [
...]
DEBUG  : 2019/11/22 15:52:11.030859 [conn-1, bolt-90]: C[68] PULL_ALL []
INFO   : 2019/11/22 15:52:11.030886 [conn-1, bolt-90]: (Sent 642 of 642 bytes)
2019/11/22 15:52:11 Run() &amp;{[] [] &lt;nil&gt; 0xc0003cc500 0xc000291780 &lt;nil&gt; 67 false 68 false} &lt;nil&gt;
INFO   : 2019/11/22 15:52:11.035301 [conn-1, bolt-90]: Received 188 of 2..8192 bytes
DEBUG  : 2019/11/22 15:52:11.035324 [conn-1, bolt-90]: S[67] FAILURE [{code: Neo.ClientError.Statement.SyntaxError, message: Unexpected end of input: expected whitespace, comment or IN (line 8, column 12 (offset: 325))
"FOREACH (k "
            ^}]
DEBUG  : 2019/11/22 15:52:11.035332 [conn-1, bolt-90]: &lt;FAILURE code="Neo.ClientError.Statement.SyntaxError"&gt;
DEBUG  : 2019/11/22 15:52:11.035337 [conn-1, bolt-90]: &lt;FAILURE message="Unexpected end of input: expected whitespace, comment or IN (line 8, column 12 (offset: 325))
"FOREACH (k "
            ^"&gt;
INFO   : 2019/11/22 15:52:11.035341 [conn-1, bolt-90]: &lt;FAILED&gt; [BoltConnection_fetch(/Users/neo/buildAgent/work/c4f1f1576663d58b/seabolt/src/seabolt/src/bolt/connection.c:353), failure message]
DEBUG  : 2019/11/22 15:52:11.035379 [conn-1, bolt-90]: S[68] IGNORED []
INFO   : 2019/11/22 15:52:11.035396 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/11/22 15:52:11.035406 [conn-1, bolt-90]: C[69] RESET []
INFO   : 2019/11/22 15:52:11.035427 [conn-1, bolt-90]: (Sent 6 of 6 bytes)
INFO   : 2019/11/22 15:52:11.035746 [conn-1, bolt-90]: Received 7 of 2..8192 bytes
DEBUG  : 2019/11/22 15:52:11.035761 [conn-1, bolt-90]: S[69] SUCCESS [{}]
INFO   : 2019/11/22 15:52:11.035766 [conn-1, bolt-90]: &lt;READY&gt;

Process finished with exit code 0
</code></pre></div>
<p dir="auto">EDIT:</p>
<p dir="auto">I'm going to go ahead and add to this issue:</p>
<p dir="auto">Using the following code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="		session, err := neo4jdb.Driver.Session(neo4j.AccessModeWrite)
		if err != nil {
			panic(err)
		}
		defer session.Close()
		_, err = session.Run(`
CREATE (:Client {name: {name}})`,
		map[string]interface{}{
			&quot;name&quot;: &quot;ABC&quot;,
		})"><pre class="notranslate"><code class="notranslate">		session, err := neo4jdb.Driver.Session(neo4j.AccessModeWrite)
		if err != nil {
			panic(err)
		}
		defer session.Close()
		_, err = session.Run(`
CREATE (:Client {name: {name}})`,
		map[string]interface{}{
			"name": "ABC",
		})
</code></pre></div>
<p dir="auto">I receive the following in my terminal as output:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="INFO   : 2019/11/22 18:25:02.524717 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/11/22 18:25:02.524787 [conn-1, bolt-109]: C[10] RUN [
CREATE (:Client {name: {name}}), {name: ABC}, {}]
DEBUG  : 2019/11/22 18:25:02.524808 [conn-1, bolt-109]: C[11] PULL_ALL []
INFO   : 2019/11/22 18:25:02.524858 [conn-1, bolt-109]: (Sent 79 of 79 bytes)
INFO   : 2019/11/22 18:25:02.526117 [conn-1, bolt-109]: Received 170 of 2..8192 bytes
DEBUG  : 2019/11/22 18:25:02.526150 [conn-1, bolt-109]: S[10] FAILURE [{code: Neo.ClientError.Schema.ConstraintValidationFailed, message: Node(1) already exists with label `Client` and property `name` = 'ABC'}]
DEBUG  : 2019/11/22 18:25:02.526160 [conn-1, bolt-109]: &lt;FAILURE code=&quot;Neo.ClientError.Schema.ConstraintValidationFailed&quot;&gt;
DEBUG  : 2019/11/22 18:25:02.526165 [conn-1, bolt-109]: &lt;FAILURE message=&quot;Node(1) already exists with label `Client` and property `name` = 'ABC'&quot;&gt;
INFO   : 2019/11/22 18:25:02.526170 [conn-1, bolt-109]: &lt;FAILED&gt; [BoltConnection_fetch(/Users/neo/buildAgent/work/c4f1f1576663d58b/seabolt/src/seabolt/src/bolt/connection.c:353), failure message]
DEBUG  : 2019/11/22 18:25:02.526238 [conn-1, bolt-109]: S[11] IGNORED []
INFO   : 2019/11/22 18:25:02.526301 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/11/22 18:25:02.526318 [conn-1, bolt-109]: C[12] RESET []
INFO   : 2019/11/22 18:25:02.526354 [conn-1, bolt-109]: (Sent 6 of 6 bytes)
INFO   : 2019/11/22 18:25:02.526691 [conn-1, bolt-109]: Received 7 of 2..8192 bytes
DEBUG  : 2019/11/22 18:25:02.526707 [conn-1, bolt-109]: S[12] SUCCESS [{}]
INFO   : 2019/11/22 18:25:02.526713 [conn-1, bolt-109]: &lt;READY&gt;"><pre class="notranslate"><code class="notranslate">INFO   : 2019/11/22 18:25:02.524717 [pool-1]: Acquiring connection from the pool towards localhost:7687
DEBUG  : 2019/11/22 18:25:02.524787 [conn-1, bolt-109]: C[10] RUN [
CREATE (:Client {name: {name}}), {name: ABC}, {}]
DEBUG  : 2019/11/22 18:25:02.524808 [conn-1, bolt-109]: C[11] PULL_ALL []
INFO   : 2019/11/22 18:25:02.524858 [conn-1, bolt-109]: (Sent 79 of 79 bytes)
INFO   : 2019/11/22 18:25:02.526117 [conn-1, bolt-109]: Received 170 of 2..8192 bytes
DEBUG  : 2019/11/22 18:25:02.526150 [conn-1, bolt-109]: S[10] FAILURE [{code: Neo.ClientError.Schema.ConstraintValidationFailed, message: Node(1) already exists with label `Client` and property `name` = 'ABC'}]
DEBUG  : 2019/11/22 18:25:02.526160 [conn-1, bolt-109]: &lt;FAILURE code="Neo.ClientError.Schema.ConstraintValidationFailed"&gt;
DEBUG  : 2019/11/22 18:25:02.526165 [conn-1, bolt-109]: &lt;FAILURE message="Node(1) already exists with label `Client` and property `name` = 'ABC'"&gt;
INFO   : 2019/11/22 18:25:02.526170 [conn-1, bolt-109]: &lt;FAILED&gt; [BoltConnection_fetch(/Users/neo/buildAgent/work/c4f1f1576663d58b/seabolt/src/seabolt/src/bolt/connection.c:353), failure message]
DEBUG  : 2019/11/22 18:25:02.526238 [conn-1, bolt-109]: S[11] IGNORED []
INFO   : 2019/11/22 18:25:02.526301 [pool-1]: Releasing connection to pool towards localhost:7687
DEBUG  : 2019/11/22 18:25:02.526318 [conn-1, bolt-109]: C[12] RESET []
INFO   : 2019/11/22 18:25:02.526354 [conn-1, bolt-109]: (Sent 6 of 6 bytes)
INFO   : 2019/11/22 18:25:02.526691 [conn-1, bolt-109]: Received 7 of 2..8192 bytes
DEBUG  : 2019/11/22 18:25:02.526707 [conn-1, bolt-109]: S[12] SUCCESS [{}]
INFO   : 2019/11/22 18:25:02.526713 [conn-1, bolt-109]: &lt;READY&gt;
</code></pre></div>
<p dir="auto">Note that the panic is not called. The call to Session.Run() is not returning any errors despite the presence of errors in the debug logs. Additionally, using Session.Run() to create constraints does absolutely nothing, thought running it in the browser works just fine.</p>
<p dir="auto">To clarify, if I run the same query in the browser (localhost:7474), I get the errors as expected.<br>
I have restarted my Neo4j service. (it is a brew installed service)</p>