owasp-amass/amass · error

error unmarshalling datasources YAML: %v

Error message

error unmarshalling datasources YAML: %v

What it means

The datasources YAML file was read successfully but yaml.Unmarshal failed to decode it into DataSourceConfig: the file contains syntactically or structurally invalid YAML (bad indentation, duplicate keys, or a shape that does not match the DataSourceConfig schema). The yaml error is wrapped with %v, so details of the offending line are in the underlying error.

Source

Thrown at config/datasrcs.go:113

	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)
	}

	dsConfig.MapNames()
	// Assign the unmarshalled DataSourceConfig to the Config struct
	c.DataSrcConfigs = &dsConfig
	c.DataSrcConfigs.ttlCheck()
	return nil
}

func (dsc *DataSourceConfig) ttlCheck() {
	// The global minimum TTL is already loaded during the YAML unmarshalling process
	for _, ds := range dsc.Datasources {
		// Ensure the TTL is not less than the global minimum
		if dsc.GlobalOptions != nil {
			if minTTL, ok := dsc.GlobalOptions["minimum_ttl"]; ok && minTTL > ds.TTL {
				ds.TTL = dsc.GlobalOptions["minimum_ttl"]
			}
		} else {

View on GitHub (pinned to 79299dce87)

Solutions

  1. Validate the datasources YAML with a linter or 'yaml.Unmarshal' in a scratch program to find the exact parse error
  2. Compare the file's structure against the DataSourceConfig schema and fix field names/nesting
  3. Use %w wrapping so the yaml.TypeError with line numbers propagates to the user
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at config/datasrcs.go:113 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/42321627308e713f. Report an issue: GitHub.