owasp-amass/amass · error
datasources option is not a string
Error message
datasources option is not a string
What it means
loadDataSourceSettings reads the 'datasources' option from the config options map, which must be a string path to a data-sources file. If the value is present but not a string (number, bool, list, map), the load fails with 'datasources option is not a string'. This is an early type check before the path is resolved and loaded.
Source
Thrown at config/datasrcs.go:97
for _, creds := range src.Creds {
return creds // Return the first set of credentials found
}
}
}
return nil
}
func (c *Config) loadDataSourceSettings(cfg *Config) error {
// Retrieve the datasources file path from the options
pathInterface, ok := c.Options["datasources"]
if !ok {
// "datasources" not found in options, so nothing to do here.
return nil
}
path, ok := pathInterface.(string)
if !ok {
return fmt.Errorf("datasources option is not a string")
}
// Construct the absolute path by joining the current working directory and the relative path
absPath, err := c.AbsPathFromConfigDir(path)
if err != nil {
return fmt.Errorf("failed to get absolute path: %v", err)
}
// Load the datasources YAML file
data, err := os.ReadFile(absPath)
if err != nil {
return fmt.Errorf("error reading datasources file: %v", err)
}
// Unmarshal the YAML data into a DataSourceConfig
var dsConfig DataSourceConfig
err = yaml.Unmarshal(data, &dsConfig)
if err != nil {
return fmt.Errorf("error unmarshalling datasources YAML: %v", err)
}
View on GitHub (pinned to 79299dce87)
Solutions
- Quote the value so YAML parses it as a string: datasources: "datasources.yaml".
- Confirm the option expects a path to a datasources file, not an inline structure.
- Validate the config with a YAML parser and inspect the datasources value's type.
- If the value is generated programmatically, stringify it before writing the config.
Example fix
// before (config.yaml) datasources: 2024 // after datasources: "2024.yaml"
Defensive patterns
Strategy: validation
Validate before calling
raw, _ := os.ReadFile(cfgPath)
var doc map[string]any
_ = yaml.Unmarshal(raw, &doc)
if v, ok := doc["datasources"]; ok {
if _, ok := v.(string); !ok {
return fmt.Errorf("datasources must be a string path, got %T", v)
}
} Type guard
func isString(v any) bool {
_, ok := v.(string)
return ok
} Try / catch
if err := cfg.LoadSettings(path); err != nil {
if strings.Contains(err.Error(), "datasources option is not a string") {
// quote the value or correct the type in the config
}
return err
} Prevention
- Quote the datasources path in YAML so it parses as a string
- Validate config types in CI with a schema check
- Stringify programmatically generated values before writing configs
- Document that datasources expects a file path, not inline data
When it happens
Trigger: A config with a non-string 'datasources' value, e.g. datasources: 123, datasources: true, or datasources: [a.yaml]. Triggered during LoadSettings when the key exists in options and the interface type assertion to string fails.
Common situations: Hand-edited YAML where an unquoted filename looks numeric (datasources: 2024.yaml becomes an int); tooling that generated the config with the wrong type; misunderstanding that datasources takes a file path, not an inline list.
Related errors
- alterations wordlist_file item is not a string
- resolvers section is not a list
- error mapping configuration settings to internal values: %v
- brute forcing cannot be performed without DNS resolution
- active enumeration cannot be performed without DNS resolutio
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/6c7c85ab3676bebc.
Report an issue: GitHub.