owasp-amass/amass · error
expected 'engine' to be a string, got %T
Error message
expected 'engine' to be a string, got %T
What it means
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.
Source
Thrown at config/engineapi.go:53
)
// loadEngineSettings is responsible for extracting the "engine" URL from the application's configuration
// and initializing the EngAPI structure. It performs several checks such as ensuring the configuration options
// are initialized and the "engine" key is present and of type string. If any of these checks fail, an error is returned.
func (c *Config) loadEngineSettings(cfg *Config) error {
// Check if configuration options are initialized; if not, return an error.
if c.Options == nil {
return fmt.Errorf("config options are not initialized")
}
// Attempt to retrieve the "engine" value from the configuration options.
apiURIInterface, ok := c.Options["engine"]
if !ok {
return c.LoadEngineEnvSettings()
}
// Assert that the "engine" option is of type string; if not, return an error specifying the incorrect type received.
apiURI, ok := apiURIInterface.(string)
if !ok {
return fmt.Errorf("expected 'engine' to be a string, got %T", apiURIInterface)
}
// Load the Engine API URI information into the EngAPI structure.
// If there's an error during this process, it's returned to the calling function.
if err := c.loadEngineURI(apiURI); err != nil {
return err
}
return nil
}
// LoadEngineEnvSettings initializes the EngAPI structure with the Environment variables.
func (c *Config) LoadEngineEnvSettings() error {
apiURI := ""
eng := &EngAPI{}
h := "localhost"
if henv, set := os.LookupEnv(engineHost); set {
h = henv
}View on GitHub (pinned to 79299dce87)
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
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at config/engineapi.go:53 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/544fee6ce870f6f4.
Report an issue: GitHub.