owasp-amass/amass · error
failed to get absolute path of the configuration file: %v
Error message
failed to get absolute path of the configuration file: %v
What it means
Config.LoadSettings begins by converting the given config path to an absolute path with filepath.Abs. If that OS-level call fails, the library still loads database and engine env-var settings as a best effort, then returns 'failed to get absolute path of the configuration file'. This is rare because filepath.Abs only fails when resolving the working directory fails (e.g. deleted CWD).
Source
Thrown at config/config.go:264
if err != nil {
return err
}
c.AltWordlist, err = ExpandMaskWordlist(c.AltWordlist)
if err != nil {
return err
}
return err
}
// LoadSettings parses settings from an .yaml file and assigns them to the Config.
func (c *Config) LoadSettings(path string) error {
// Determine and store the absolute path of the config file
absolutePath, err := filepath.Abs(path)
if err != nil {
_ = c.LoadDatabaseEnvSettings()
_ = c.LoadEngineEnvSettings()
return fmt.Errorf("failed to get absolute path of the configuration file: %v", err)
}
c.Filepath = absolutePath
// Open the configuration file
data, err := os.ReadFile(c.Filepath)
if err != nil {
_ = c.LoadDatabaseEnvSettings()
_ = c.LoadEngineEnvSettings()
return fmt.Errorf("failed to load the main configuration file: %v", err)
}
err = yaml.Unmarshal(data, c)
if err != nil {
_ = c.LoadDatabaseEnvSettings()
_ = c.LoadEngineEnvSettings()
return fmt.Errorf("error mapping configuration settings to internal values: %v", err)
}
View on GitHub (pinned to 79299dce87)
Solutions
- Start the process from a valid, existing working directory.
- Pass an absolute config path so relative resolution is trivial (Abs still consults CWD, so also ensure CWD exists).
- Check LoadDatabaseEnvSettings/LoadEngineEnvSettings still populated what you need, since they run before this error is returned.
- Restart the process if its CWD was deleted.
Defensive patterns
Strategy: validation
Validate before calling
if _, err := os.Getwd(); err != nil {
return fmt.Errorf("current working directory is unusable: %w", err)
}
if !filepath.IsAbs(path) {
path, _ = filepath.Abs(path)
} Try / catch
if err := cfg.LoadSettings(path); err != nil {
if strings.Contains(err.Error(), "failed to get absolute path of the configuration file") {
// restart process from a valid working directory
}
return err
} Prevention
- Never delete the directory a running process uses as CWD
- Start long-running services from stable directories (e.g. / or /srv)
- Pass absolute config paths to reduce CWD dependence
When it happens
Trigger: Calling LoadSettings(path) while the process's current working directory has been deleted, or on platforms where getting the working directory fails. filepath.Abs errors come from os.Getwd, not from the path string itself.
Common situations: A long-running process whose working directory was removed; running from a deleted tmp directory; chroot/jail environments without a resolvable CWD.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- file does not exist: %v
- failed to obtain the Amass output directory
- unable to load the file in the alterations wordlist_file set
- no resolver keys were found in the resolvers section
- brute forcing cannot be performed without DNS resolution
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/570daa3c8470c955.
Report an issue: GitHub.