{"record":{"id":"6fc2a89aa26aeac3","repo":"owasp-amass/amass","slug":"missing-scheme-in-database-uri-6fc2a8","errorCode":null,"errorMessage":"missing scheme in database URI","messagePattern":"missing scheme in database URI","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/graphdb.go","lineNumber":111,"sourceCode":"\t} else {\n\t\tdbURI = \"postgres://\" + u + \"@\" + h + \":\" + port + \"/\" + n\n\t}\n\tdb.URL = dbURI\n\tif c.GraphDBs == nil {\n\t\tc.GraphDBs = make([]*Database, 0)\n\t}\n\tc.GraphDBs = append(c.GraphDBs, db)\n\treturn nil\n}\n\nfunc (c *Config) loadDatabase(dbURI string) error {\n\tu, err := url.Parse(dbURI)\n\tif err != nil {\n\t\treturn err\n\t}\n\t// Check for valid scheme (database type)\n\tif u.Scheme == \"\" {\n\t\treturn fmt.Errorf(\"missing scheme in database URI\")\n\t}\n\t// Check for non-empty username\n\tif u.User == nil || u.User.Username() == \"\" {\n\t\treturn fmt.Errorf(\"missing username in database URI\")\n\t}\n\t// Check for reachable hostname\n\tif u.Hostname() == \"\" {\n\t\treturn fmt.Errorf(\"missing hostname in database URI\")\n\t}\n\n\tdbName := \"\"\n\t// Only get the database name if it's not empty or a single slash\n\tif u.Path != \"\" && u.Path != \"/\" {\n\t\tdbName = strings.TrimPrefix(u.Path, \"/\")\n\t}\n\n\tdb := &Database{\n\t\tPrimary:  true, // Set as primary, because it wouldn't be there otherwise.","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/graphdb.go#L93-L129","documentation":"loadDatabase parses the configured database URI with url.Parse and validates its parts. A URI with no scheme (e.g. 'localhost:7687/user' without 'neo4j://') is rejected because the scheme identifies the database type the driver should use.","triggerScenarios":"A GraphDB URI in the config file that omits the scheme, e.g. 'localhost:7474' or 'user@host/db', passed to loadDatabase via loadDatabaseSettings.","commonSituations":"Hand-editing the config and dropping the 'neo4j://' or 'postgres://' prefix; config examples copied from tools that accept bare host:port; YAML values containing special chars that mangle the URI.","solutions":["Prefix the URI with its database scheme, e.g. neo4j://host:7687/dbname.","Validate the URI by running it through `python3 -c \"import urllib.parse;print(urllib.parse.urlparse('...').scheme)\"` or a similar parser before saving the config.","Check the config file for quoting issues that may have stripped the scheme."],"exampleFix":"// before\n\"database\": \"localhost:7687/mydb\"\n// after\n\"database\": \"neo4j://localhost:7687/mydb\"","handlingStrategy":"validation","validationCode":"u, err := url.Parse(dbURI)\nif err != nil || u.Scheme == \"\" {\n    return errors.New(\"database URI must include a scheme, e.g. neo4j://host\")\n}","typeGuard":null,"tryCatchPattern":"if err := loadDatabase(uri); err != nil {\n    if strings.Contains(err.Error(), \"missing scheme\") {\n        uri = \"neo4j://\" + uri // or surface a config fix hint\n    }\n}","preventionTips":["Always store full URIs with scheme in configs","Lint config URIs with url.Parse before deployment","Copy connection strings from driver docs, not bare host:port"],"tags":["url","configuration","validation"],"backgroundTag":"invalid-url-format","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}