owasp-amass/amass · error

failed to load resolvers from file: %w

Error message

failed to load resolvers from file: %w

What it means

After resolving the absolute path of a resolver file, loadResolverSettings calls loadResolversFromFile to read and parse it. Any error from that call (missing file, unreadable, bad format) is wrapped as 'failed to load resolvers from file'.

Source

Thrown at config/resolvers.go:199

			return fmt.Errorf("resolver entry %v is not a string", r)
		}

		// Check if rStr is an IP address.
		ip := net.ParseIP(rStr)
		if ip != nil {
			resolversList = append(resolversList, rStr)
			continue
		}

		// rStr is not an IP address, so we assume it is a file path.
		absPath, err := c.AbsPathFromConfigDir(rStr)
		if err != nil {
			return fmt.Errorf("failed to get absolute path for resolver file: %w", err)
		}

		fileResolvers, err := c.loadResolversFromFile(absPath)
		if err != nil {
			return fmt.Errorf("failed to load resolvers from file: %w", err)
		}

		resolversList = append(resolversList, fileResolvers...)

	}

	// Deduplicate the list of resolvers and assign to c.Resolvers.
	resolverIPs := stringset.Deduplicate(resolversList)

	if len(resolverIPs) == 0 {
		return errors.New("no valid resolvers were found")
	}

	c.Resolvers = resolverIPs

	return nil
}

View on GitHub (pinned to 79299dce87)

Solutions

  1. Check the file exists and is readable at the path named in the wrapped error (errors.Unwrap the cause).
  2. Fix the file's content/format per loadResolversFromFile's expectations (IP-per-line list).
  3. Remove or correct the resolver file entry in the config if the file is no longer needed.

Example fix

// before
resolvers:
  - "/old/path/resolvers.txt"   # deleted
// after
resolvers:
  - "/home/user/.config/amass/resolvers.txt"
Defensive patterns

Strategy: validation

Validate before calling

for _, p := range resolverFilePaths {
    if _, err := os.Stat(p); err != nil {
        return fmt.Errorf("resolver file missing: %s", p)
    }
}

Try / catch

if err := loadResolverSettings(); err != nil {
    if strings.Contains(err.Error(), "load resolvers from file") {
        return fmt.Errorf("check resolver file existence/content: %w", errors.Unwrap(err))
    }
}

Prevention

When it happens

Trigger: A resolver entry pointing at a file path where the file does not exist, cannot be opened, or fails the parser inside loadResolversFromFile.

Common situations: Deleted or moved resolver list files; permission errors reading the file; a resolver file with malformed content; stale config entries after reorganizing dotfiles.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of owasp-amass/amass@79299dce87 (2026-09-06). Data as JSON: /api/errors/ae2f307bc18cd6d2. Report an issue: GitHub.