owasp-amass/amass · error

failed to get absolute path: %v

Error message

failed to get absolute path: %v

What it means

loadDataSourceSettings could not turn the configured 'datasources' file path into an absolute path: AbsPathFromConfigDir returned an error (unresolvable working/config directory or malformed path). The raw error is wrapped with %v, losing errors.Is unwrap-ability. File I/O has not been attempted yet at this point.

Source

Thrown at config/datasrcs.go:102

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

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

View on GitHub (pinned to 79299dce87)

Solutions

  1. Check the 'datasources' option value in the config YAML/CLI for typos or invalid characters
  2. Ensure the configuration directory (and current working directory it is resolved against) exists and is readable
  3. Use %w instead of %v when wrapping so callers can inspect the underlying path error
Defensive patterns

Strategy: validation

When it happens

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