{"record":{"id":"570daa3c8470c955","repo":"owasp-amass/amass","slug":"failed-to-get-absolute-path-of-the-configuration-f","errorCode":null,"errorMessage":"failed to get absolute path of the configuration file: %v","messagePattern":"failed to get absolute path of the configuration file: (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/config.go","lineNumber":264,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\n\tc.AltWordlist, err = ExpandMaskWordlist(c.AltWordlist)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn err\n}\n\n// LoadSettings parses settings from an .yaml file and assigns them to the Config.\nfunc (c *Config) LoadSettings(path string) error {\n\t// Determine and store the absolute path of the config file\n\tabsolutePath, err := filepath.Abs(path)\n\tif err != nil {\n\t\t_ = c.LoadDatabaseEnvSettings()\n\t\t_ = c.LoadEngineEnvSettings()\n\t\treturn fmt.Errorf(\"failed to get absolute path of the configuration file: %v\", err)\n\t}\n\tc.Filepath = absolutePath\n\n\t// Open the configuration file\n\tdata, err := os.ReadFile(c.Filepath)\n\tif err != nil {\n\t\t_ = c.LoadDatabaseEnvSettings()\n\t\t_ = c.LoadEngineEnvSettings()\n\t\treturn fmt.Errorf(\"failed to load the main configuration file: %v\", err)\n\t}\n\n\terr = yaml.Unmarshal(data, c)\n\tif err != nil {\n\t\t_ = c.LoadDatabaseEnvSettings()\n\t\t_ = c.LoadEngineEnvSettings()\n\t\treturn fmt.Errorf(\"error mapping configuration settings to internal values: %v\", err)\n\t}\n","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/config.go#L246-L282","documentation":"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).","triggerScenarios":"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.","commonSituations":"A long-running process whose working directory was removed; running from a deleted tmp directory; chroot/jail environments without a resolvable CWD.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, err := os.Getwd(); err != nil {\n    return fmt.Errorf(\"current working directory is unusable: %w\", err)\n}\nif !filepath.IsAbs(path) {\n    path, _ = filepath.Abs(path)\n}","typeGuard":null,"tryCatchPattern":"if err := cfg.LoadSettings(path); err != nil {\n    if strings.Contains(err.Error(), \"failed to get absolute path of the configuration file\") {\n        // restart process from a valid working directory\n    }\n    return err\n}","preventionTips":["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"],"tags":["config","filesystem","path-resolution","working-directory"],"backgroundTag":"invalid-config-value","analyzedSha":"79299dce87b0085db0f2f4ef3e9c52cccb49f514","analyzedAt":"2026-09-06T08:22:48.198Z","contentChangedAt":"2026-09-06T08:22:48.198Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}