{"record":{"id":"8ac87a8ed83d41f5","repo":"t8y2/dbx","slug":"neo4j-host-is-required","errorCode":null,"errorMessage":"Neo4j host is required","messagePattern":"Neo4j host is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agents/drivers/neo4j-go/driver.go","lineNumber":127,"sourceCode":"\t\t}\n\t}, nil\n}\n\nfunc buildNeo4jURI(params connectParams) (string, error) {\n\tif value := strings.TrimSpace(params.ConnectionString); value != \"\" {\n\t\tvalue = strings.TrimPrefix(value, \"jdbc:\")\n\t\tparsed, err := url.Parse(value)\n\t\tif err == nil && isNeo4jScheme(parsed.Scheme) && parsed.Host != \"\" {\n\t\t\tparsed.User = nil\n\t\t\tparsed.Path = \"\"\n\t\t\tparsed.RawPath = \"\"\n\t\t\tparsed.RawQuery = filterDriverURIQuery(parsed.Query()).Encode()\n\t\t\treturn parsed.String(), nil\n\t\t}\n\t}\n\thost := strings.TrimSpace(params.Host)\n\tif host == \"\" {\n\t\treturn \"\", errors.New(\"Neo4j host is required\")\n\t}\n\tport := params.Port\n\tif port <= 0 {\n\t\tport = defaultNeo4jPort\n\t}\n\tscheme := \"neo4j\"\n\tquery := parseURLParams(params.URLParams)\n\tif configured := strings.ToLower(strings.TrimSpace(query.Get(\"scheme\"))); isNeo4jScheme(configured) {\n\t\tscheme = configured\n\t} else if params.SSL || queryBool(query, \"ssl\") || queryBool(query, \"encrypted\") || params.CACertPath != \"\" || params.ClientCertPath != \"\" {\n\t\tscheme = \"neo4j+s\"\n\t}\n\treturn (&url.URL{Scheme: scheme, Host: net.JoinHostPort(host, strconv.Itoa(port))}).String(), nil\n}\n\nfunc isNeo4jScheme(value string) bool {\n\tswitch strings.ToLower(value) {\n\tcase \"neo4j\", \"neo4j+s\", \"neo4j+ssc\", \"bolt\", \"bolt+s\", \"bolt+ssc\":","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/t8y2/dbx/blob/c0390bff16418b651f4728520d99adf8ce48829a/agents/drivers/neo4j-go/driver.go#L109-L145","documentation":"buildNeo4jURI assembles the neo4j:// (or neo4j+s://) connection URI from the params. When no pre-parsed URI was supplied and params.Host is empty or whitespace-only, there is no host to build a URI from, so it fails fast with this error.","triggerScenarios":"Calling openDriver (directly or via the driver agent's open/connect dispatch) with neither a URI nor params.Host, or with params.Host set to \"   \" (whitespace only, trimmed away).","commonSituations":"Env var for the Neo4j host not set in a deployment, config struct zero-valued because YAML/JSON keys mismatched, forgetting host when only port/credentials were configured.","solutions":["Set params.Host to the Neo4j server hostname or IP.","Alternatively pass a full connection URI (e.g. neo4j+s://host:7687) instead of host/port fields.","Check the env/config source that populates Host; log the params struct to confirm it is not empty."],"exampleFix":"// before\nparams := neo4jgo.DriverParams{Port: 7687} // Host empty\n// after\nparams := neo4jgo.DriverParams{Host: \"neo4j.internal\", Port: 7687}","handlingStrategy":"validation","validationCode":"if uri == \"\" && strings.TrimSpace(host) == \"\" {\n    return errors.New(\"neo4j: either uri or host must be configured\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fail fast at config load if required host/URI env vars are empty","Log the resolved connection params (minus credentials) at startup","Centralize config parsing so Host cannot be silently zero-valued"],"tags":["neo4j","configuration","connection","uri"],"backgroundTag":"missing-required-config","analyzedSha":"c0390bff16418b651f4728520d99adf8ce48829a","analyzedAt":"2026-09-05T23:05:10.900Z","contentChangedAt":"2026-09-05T23:05:10.900Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}