owasp-amass/amass · error
failed to load the configuration file: %v
Error message
failed to load the configuration file: %v
What it means
LoadSettings parses an INI configuration file with go-ini's LoadSources (case-insensitive keys, shadow values allowed). If the file cannot be read or parsed as INI, the underlying error is wrapped with this message.
Source
Thrown at cmd/oam_i2y/ini.go:118
// Database contains values required for connecting with graph databases.
type Database struct {
System string
Primary bool `ini:"primary"`
URL string `ini:"url"`
Username string `ini:"username"`
Password string `ini:"password"`
DBName string `ini:"database"`
Options string `ini:"options"`
}
// LoadSettings parses settings from an .ini file and assigns them to the Config.
func (c *Config) LoadSettings(path string) error {
cfg, err := ini.LoadSources(ini.LoadOptions{
Insensitive: true,
AllowShadows: true,
}, path)
if err != nil {
return fmt.Errorf("failed to load the configuration file: %v", err)
}
// Get the easy ones out of the way using mapping
if err = cfg.MapTo(c); err != nil {
return fmt.Errorf("error mapping configuration settings to internal values: %v", err)
}
// Attempt to load a special mode of operation specified by the user
if cfg.Section(ini.DefaultSection).HasKey("mode") {
mode := cfg.Section(ini.DefaultSection).Key("mode").String()
switch mode {
case "passive":
c.Passive = true
case "active":
c.Active = true
}
}
loads := []func(cfg *ini.File) error{View on GitHub (pinned to 79299dce87)
Solutions
- Verify the file exists and is readable at the given path (os.Stat, ls -l).
- Ensure the file is valid INI syntax — [section] headers and key=value pairs, correct encoding (UTF-8/ASCII).
- Read the wrapped %v error for the precise cause (no such file vs permission denied vs parse error) and fix accordingly.
Example fix
// before
err := cfg.LoadSettings("/etc/amass/config.ini.bak2")
// after
path := "/etc/amass/config.ini"
if _, err := os.Stat(path); err != nil {
log.Fatalf("config not found: %v", err)
}
err := cfg.LoadSettings(path) Defensive patterns
Strategy: try-catch
Validate before calling
if fi, err := os.Stat(path); err != nil {
return fmt.Errorf("config file missing: %w", err)
} else if fi.IsDir() {
return fmt.Errorf("config path is a directory: %s", path)
} Try / catch
if err := cfg.LoadSettings(path); err != nil {
if strings.Contains(err.Error(), "failed to load the configuration file") {
// surface wrapped cause, prompt user for correct -i path
return fmt.Errorf("check --config path %s: %w", path, err)
}
} Prevention
- Validate the config path exists before invoking the tool.
- Keep configs in INI format, UTF-8 encoded.
- Version-control the config so accidental deletions are recoverable.
When it happens
Trigger: Passing a path to a nonexistent file, a directory, a file with permission errors, or content that is not valid INI syntax (unclosed sections, garbage bytes) to Config.LoadSettings.
Common situations: Wrong path passed to oam_i2y (-i flag typo); config file with YAML/JSON content instead of INI; file deleted or renamed after deployment; encoding issues (UTF-16 exports from Windows tools).
Understand the failure class
Background: "Config file not found": what it means and how to fix it in docker-sync, Maven, Vagrant, Turborepo and other tools — this error's family across 60 libraries.
Related errors
- error mapping configuration settings to internal values: %v
- no resolver keys were found in the resolvers section
- failed to parse active setting, value is not a boolean
- bruteforce is not a map[string]interface{}
- bruteforce enabled is not a bool
AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06).
Data as JSON: /api/errors/eabbd80214128ef5.
Report an issue: GitHub.