{"record":{"id":"eadc21f7075289dc","repo":"owasp-amass/amass","slug":"config-options-are-not-initialized-eadc21","errorCode":null,"errorMessage":"config options are not initialized","messagePattern":"config options are not initialized","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/graphdb.go","lineNumber":37,"sourceCode":"\tUsername string `json:\"username,omitempty\"` // Username for authentication\n\tPassword string `json:\"password,omitempty\"` // Password for authentication\n\tHost     string `json:\"host,omitempty\"`     // Host of the database\n\tPort     string `json:\"port,omitempty\"`     // Port of the database\n\tDBName   string `json:\"db_name,omitempty\"`  // Name of the database\n\tOptions  string `json:\"options,omitempty\"`  // Extra options used while connecting to the database\n}\n\nconst (\n\tamassUser   = \"AMASS_DB_USER\"\n\tamassPass   = \"AMASS_DB_PASSWORD\"\n\tassetDB     = \"AMASS_DB_HOST\"\n\tassetPort   = \"AMASS_DB_PORT\"\n\tassetDBName = \"AMASS_DB_NAME\"\n)\n\nfunc (c *Config) loadDatabaseSettings(cfg *Config) error {\n\tif c.Options == nil {\n\t\treturn fmt.Errorf(\"config options are not initialized\")\n\t}\n\n\tdbURIInterface, ok := c.Options[\"database\"]\n\tif !ok {\n\t\tif err := c.LoadDatabaseEnvSettings(); err != nil {\n\t\t\treturn nil\n\t\t}\n\t}\n\n\tdbURI, ok := dbURIInterface.(string)\n\tif !ok {\n\t\treturn fmt.Errorf(\"expected 'database' to be a string, got %T\", dbURIInterface)\n\t}\n\n\tif _, err := url.Parse(dbURI); err == nil {\n\t\tif err := c.loadDatabase(dbURI); err != nil {\n\t\t\treturn err\n\t\t}","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/graphdb.go#L19-L55","documentation":"loadDatabaseSettings found c.Options nil: the configuration option map was never initialized before the 'database' key lookup. Like its engine counterpart, it is a precondition guard indicating earlier configuration loading did not run or failed silently — the database URI value itself is not the problem.","triggerScenarios":"Thrown at config/graphdb.go:37 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Initialize/populate Config.Options from the config file, CLI flags, or env before loadDatabaseSettings runs","Audit the configuration pipeline for swallowed errors that leave Options nil","Consider defaulting Options to an empty map at construction so lookups return 'not found' instead of erroring"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}