owasp-amass/amass · error

error reading datasources file: %v

Error message

error reading datasources file: %v

What it means

loadDataSourceSettings resolved the datasources YAML file to an absolute path but os.ReadFile failed on it — typically the file does not exist, is a directory, or lacks read permission. The os error is wrapped with %v; the message names the file-reading step specifically, distinguishing it from path resolution and unmarshalling failures.

Source

Thrown at config/datasrcs.go:107

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

	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 {

View on GitHub (pinned to 79299dce87)

Solutions

  1. Verify the datasources file exists at the resolved absolute path and is a regular file
  2. Fix permissions (readable by the running user) if access is denied
  3. Point the 'datasources' option at the correct path or create the file if it was never generated
Defensive patterns

Strategy: validation

When it happens

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