{"record":{"id":"5d835dfc72bdfb83","repo":"owasp-amass/amass","slug":"failed-to-get-absolute-path-for-resolver-file-w","errorCode":null,"errorMessage":"failed to get absolute path for resolver file: %w","messagePattern":"failed to get absolute path for resolver file: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/resolvers.go","lineNumber":194,"sourceCode":"\tvar resolversList []string\n\tfor _, r := range resolvers {\n\t\t// Type assert the resolver to string\n\t\trStr, ok := r.(string)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"resolver entry %v is not a string\", r)\n\t\t}\n\n\t\t// Check if rStr is an IP address.\n\t\tip := net.ParseIP(rStr)\n\t\tif ip != nil {\n\t\t\tresolversList = append(resolversList, rStr)\n\t\t\tcontinue\n\t\t}\n\n\t\t// rStr is not an IP address, so we assume it is a file path.\n\t\tabsPath, err := c.AbsPathFromConfigDir(rStr)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to get absolute path for resolver file: %w\", err)\n\t\t}\n\n\t\tfileResolvers, err := c.loadResolversFromFile(absPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to load resolvers from file: %w\", err)\n\t\t}\n\n\t\tresolversList = append(resolversList, fileResolvers...)\n\n\t}\n\n\t// Deduplicate the list of resolvers and assign to c.Resolvers.\n\tresolverIPs := stringset.Deduplicate(resolversList)\n\n\tif len(resolverIPs) == 0 {\n\t\treturn errors.New(\"no valid resolvers were found\")\n\t}\n","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/owasp-amass/amass/blob/79299dce87b0085db0f2f4ef3e9c52cccb49f514/config/resolvers.go#L176-L212","documentation":"When a resolver entry is not an IP, loadResolverSettings treats it as a file path of resolvers and resolves it to an absolute path via c.AbsPathFromConfigDir. If that helper errors, the failure is wrapped in this error.","triggerScenarios":"A resolver entry like 'resolvers.txt' whose relative path cannot be resolved against the config directory — e.g. the config dir is unknown/empty or path computation fails inside AbsPathFromConfigDir.","commonSituations":"Running with a custom config location the tool cannot anchor; referring to a resolver file by name that does not exist relative to the config dir; permissions preventing directory traversal.","solutions":["Use an absolute path for the resolver file in the config (e.g. /etc/amass/resolvers.txt).","Verify the config directory is correctly set/discoverable and that AbsPathFromConfigDir's wrapped cause (available via errors.Unwrap) is addressed.","Ensure the referenced file exists relative to the config directory, or create it."],"exampleFix":"// before\nresolvers:\n  - \"my-resolvers.txt\"\n// after\nresolvers:\n  - \"/home/user/.config/amass/my-resolvers.txt\"","handlingStrategy":"validation","validationCode":"if !filepath.IsAbs(rStr) {\n    if _, err := os.Stat(filepath.Join(configDir, rStr)); err != nil {\n        return fmt.Errorf(\"resolver file %s not found in config dir\", rStr)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := loadResolverSettings(); err != nil {\n    if strings.Contains(err.Error(), \"absolute path for resolver file\") {\n        return fmt.Errorf(\"use absolute path for resolver file: %w\", err)\n    }\n}","preventionTips":["Use absolute paths for resolver files in configs","Ensure the config directory exists and is discoverable","Pre-check referenced files exist at startup"],"tags":["configuration","filesystem","path"],"backgroundTag":"file-not-found","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"}