sundowndev/phoneinfoga · error

given path %s does not exist

Error message

given path %s does not exist

What it means

OpenPlugin validates the filesystem path to a Go plugin (.so shared library) before loading it. If os.Stat reports the path does not exist, it returns this error immediately without attempting plugin.Open. It is a fail-fast guard so callers get a clear 'path missing' message instead of a low-level plugin loading error.

Source

Thrown at lib/remote/scanner.go:33

		return v
	}
	return os.Getenv(k)
}

type Plugin interface {
	Lookup(string) (plugin.Symbol, error)
}

type Scanner interface {
	Name() string
	Description() string
	DryRun(number.Number, ScannerOptions) error
	Run(number.Number, ScannerOptions) (interface{}, error)
}

func OpenPlugin(path string) error {
	if _, err := os.Stat(path); os.IsNotExist(err) {
		return fmt.Errorf("given path %s does not exist", path)
	}

	_, err := plugin.Open(path)
	if err != nil {
		return fmt.Errorf("given plugin %s is not valid: %v", path, err)
	}

	return nil
}

View on GitHub (pinned to 55807b05b7)

Solutions

  1. Verify the path exists before calling: run 'ls -l <path>' and fix typos or relative/absolute path mistakes
  2. Build the plugin first with 'go build -buildmode=plugin -o plugins/xyz.so ./plugins/xyz' and ensure the output path matches the configured path
  3. Use an absolute path or resolve the path relative to the executable/config, not the shell cwd
  4. Ensure the plugin file is included in deployment artifacts (Dockerfile COPY, CI artifacts)

Example fix

// before
if err := remote.OpenPlugin(cfg.PluginPath); err != nil { ... }
// after
pluginPath := filepath.Join(cfg.Dir, "scanner.so")
if _, statErr := os.Stat(pluginPath); statErr != nil {
    return fmt.Errorf("plugin not found at %s: %w", pluginPath, statErr)
}
if err := remote.OpenPlugin(pluginPath); err != nil { ... }
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Stat(path); err != nil {
    if os.IsNotExist(err) {
        return fmt.Errorf("plugin path %q does not exist", path)
    }
    return err
}
info, err := os.Stat(path)
if err == nil && info.IsDir() {
    return fmt.Errorf("plugin path %q is a directory", path)
}

Type guard

func pluginExists(path string) bool {
    info, err := os.Stat(path)
    return err == nil && !info.IsDir()
}

Try / catch

if err := remote.OpenPlugin(path); err != nil {
    if strings.Contains(err.Error(), "does not exist") {
        return fmt.Errorf("plugin missing at %s: build it first (go build -buildmode=plugin)", path)
    }
    return err
}

Prevention

When it happens

Trigger: Calling OpenPlugin(path) where path points to a nonexistent file: typo in path, plugin not built yet, wrong working directory, or the .so was deleted/moved before the scan ran.

Common situations: Plugin .so built with 'go build -buildmode=plugin' into a different directory than configured; CI passes relative path but binary runs from another cwd; container image omits the plugin file; config file still references an old plugin version that was cleaned up.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of sundowndev/phoneinfoga@55807b05b7 (2026-09-03). Data as JSON: /api/errors/f2b9669e50a574c2. Report an issue: GitHub.