{"record":{"id":"544fee6ce870f6f4","repo":"owasp-amass/amass","slug":"expected-engine-to-be-a-string-got-t","errorCode":null,"errorMessage":"expected 'engine' to be a string, got %T","messagePattern":"expected 'engine' to be a string, got %T","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/engineapi.go","lineNumber":53,"sourceCode":")\n\n// loadEngineSettings is responsible for extracting the \"engine\" URL from the application's configuration\n// and initializing the EngAPI structure. It performs several checks such as ensuring the configuration options\n// are initialized and the \"engine\" key is present and of type string. If any of these checks fail, an error is returned.\nfunc (c *Config) loadEngineSettings(cfg *Config) error {\n\t// Check if configuration options are initialized; if not, return an error.\n\tif c.Options == nil {\n\t\treturn fmt.Errorf(\"config options are not initialized\")\n\t}\n\t// Attempt to retrieve the \"engine\" value from the configuration options.\n\tapiURIInterface, ok := c.Options[\"engine\"]\n\tif !ok {\n\t\treturn c.LoadEngineEnvSettings()\n\t}\n\t// Assert that the \"engine\" option is of type string; if not, return an error specifying the incorrect type received.\n\tapiURI, ok := apiURIInterface.(string)\n\tif !ok {\n\t\treturn fmt.Errorf(\"expected 'engine' to be a string, got %T\", apiURIInterface)\n\t}\n\t// Load the Engine API URI information into the EngAPI structure.\n\t// If there's an error during this process, it's returned to the calling function.\n\tif err := c.loadEngineURI(apiURI); err != nil {\n\t\treturn err\n\t}\n\treturn nil\n}\n\n// LoadEngineEnvSettings initializes the EngAPI structure with the Environment variables.\nfunc (c *Config) LoadEngineEnvSettings() error {\n\tapiURI := \"\"\n\teng := &EngAPI{}\n\n\th := \"localhost\"\n\tif henv, set := os.LookupEnv(engineHost); set {\n\t\th = henv\n\t}","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/engineapi.go#L35-L71","documentation":"loadEngineSettings found a non-nil value under the 'engine' option key, but its Go type is not string (e.g. a map or number from a malformed YAML/JSON config). The %T verb names the actual type encountered, making this a type-shape validation of user-supplied configuration.","triggerScenarios":"Thrown at config/engineapi.go:53 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the config file so 'engine' is a URI string (e.g. \"grpc://user:pass@host:port\")","If the type is a map by design, serialize/flatten it to a URI string before it reaches Options","Add a config schema check that rejects non-string 'engine' values with a file/line reference"],"exampleFix":null,"handlingStrategy":"type-guard","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"}