{"record":{"id":"f2b9669e50a574c2","repo":"sundowndev/phoneinfoga","slug":"given-path-s-does-not-exist","errorCode":null,"errorMessage":"given path %s does not exist","messagePattern":"given path (.+?) does not exist","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/remote/scanner.go","lineNumber":33,"sourceCode":"\t\treturn v\n\t}\n\treturn os.Getenv(k)\n}\n\ntype Plugin interface {\n\tLookup(string) (plugin.Symbol, error)\n}\n\ntype Scanner interface {\n\tName() string\n\tDescription() string\n\tDryRun(number.Number, ScannerOptions) error\n\tRun(number.Number, ScannerOptions) (interface{}, error)\n}\n\nfunc OpenPlugin(path string) error {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"given path %s does not exist\", path)\n\t}\n\n\t_, err := plugin.Open(path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"given plugin %s is not valid: %v\", path, err)\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":15,"sourceCodeEnd":43,"githubUrl":"https://github.com/sundowndev/phoneinfoga/blob/55807b05b753dab7bc6fe67403ca385668dda179/lib/remote/scanner.go#L15-L43","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the path exists before calling: run 'ls -l <path>' and fix typos or relative/absolute path mistakes","Build the plugin first with 'go build -buildmode=plugin -o plugins/xyz.so ./plugins/xyz' and ensure the output path matches the configured path","Use an absolute path or resolve the path relative to the executable/config, not the shell cwd","Ensure the plugin file is included in deployment artifacts (Dockerfile COPY, CI artifacts)"],"exampleFix":"// before\nif err := remote.OpenPlugin(cfg.PluginPath); err != nil { ... }\n// after\npluginPath := filepath.Join(cfg.Dir, \"scanner.so\")\nif _, statErr := os.Stat(pluginPath); statErr != nil {\n    return fmt.Errorf(\"plugin not found at %s: %w\", pluginPath, statErr)\n}\nif err := remote.OpenPlugin(pluginPath); err != nil { ... }","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(path); err != nil {\n    if os.IsNotExist(err) {\n        return fmt.Errorf(\"plugin path %q does not exist\", path)\n    }\n    return err\n}\ninfo, err := os.Stat(path)\nif err == nil && info.IsDir() {\n    return fmt.Errorf(\"plugin path %q is a directory\", path)\n}","typeGuard":"func pluginExists(path string) bool {\n    info, err := os.Stat(path)\n    return err == nil && !info.IsDir()\n}","tryCatchPattern":"if err := remote.OpenPlugin(path); err != nil {\n    if strings.Contains(err.Error(), \"does not exist\") {\n        return fmt.Errorf(\"plugin missing at %s: build it first (go build -buildmode=plugin)\", path)\n    }\n    return err\n}","preventionTips":["Resolve plugin paths to absolute paths at config load time","Build the plugin artifact as an explicit pipeline step before the scan binary runs","Add a startup health check that lists and validates all configured plugin paths","Include plugin .so files in Docker images / deployment artifacts explicitly"],"tags":["go","plugin","filesystem","path-not-found"],"backgroundTag":"file-not-found","analyzedSha":"55807b05b753dab7bc6fe67403ca385668dda179","analyzedAt":"2026-09-03T13:37:27.908Z","contentChangedAt":"2026-09-03T13:37:27.908Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}