{"record":{"id":"1e23c8ba75a1e9bb","repo":"sundowndev/phoneinfoga","slug":"given-plugin-s-is-not-valid-v","errorCode":null,"errorMessage":"given plugin %s is not valid: %v","messagePattern":"given plugin (.+?) is not valid: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/remote/scanner.go","lineNumber":38,"sourceCode":"type 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":20,"sourceCodeEnd":43,"githubUrl":"https://github.com/sundowndev/phoneinfoga/blob/55807b05b753dab7bc6fe67403ca385668dda179/lib/remote/scanner.go#L20-L43","documentation":"After confirming the path exists, OpenPlugin calls Go's plugin.Open to load the shared object. If the file exists but is not a valid loadable plugin, the underlying plugin.Open error is wrapped as 'given plugin %s is not valid: %v'. This usually means build/incompatibility issues rather than a missing file.","triggerScenarios":"Calling OpenPlugin(path) on a file that exists but fails plugin.Open: file is not a Go plugin (regular binary, ELF without plugin mode), built with a different Go toolchain version, built without -buildmode=plugin, or compiled with mismatched package versions/flags versus the host binary.","commonSituations":"Plugin and host built with different Go versions (plugin.Open requires identical toolchain); plugin compiled as a normal executable; plugin references dependency versions that don't match the host's go.mod; trying to open a .dylib/.dll on an unsupported OS (Linux-only); stripped or rebuilt .so after host recompile.","solutions":["Read the wrapped %v detail in the message — it states the exact plugin.Open reason","Rebuild plugin and host with the exact same Go version and flags: 'go build -buildmode=plugin -o scanner.so ./plugin'","Ensure all shared dependencies are at identical versions in both the host and plugin go.mod (mismatched deps cause 'symbol ... undefined' or 'different versions' errors)","Confirm the target OS/arch supports Go plugins (Linux; not Windows/macOS reliably) and the file is actually a .so plugin, not a binary"],"exampleFix":"// before\ngo build -o scanner.so ./scanner        // wrong: not a plugin\n// after\ngo build -buildmode=plugin -o scanner.so ./scanner   # same Go version as host","handlingStrategy":"try-catch","validationCode":"info, err := os.Stat(path)\nif err != nil || info.IsDir() {\n    return fmt.Errorf(\"not a plugin file: %s\", path)\n}\nif filepath.Ext(path) != \".so\" {\n    return fmt.Errorf(\"expected .so plugin, got %s\", path)\n}","typeGuard":"func looksLikePlugin(path string) bool {\n    info, err := os.Stat(path)\n    return err == nil && !info.IsDir() && filepath.Ext(path) == \".so\"\n}","tryCatchPattern":"if err := remote.OpenPlugin(path); err != nil {\n    if strings.Contains(err.Error(), \"is not valid\") {\n        return fmt.Errorf(\"plugin %s failed to load; rebuild with same Go version and -buildmode=plugin: %v\", path, err)\n    }\n    return err\n}","preventionTips":["Pin and share the exact same Go toolchain for host and plugin builds (go.mod toolchain directive / CI matrix)","Always build plugins with -buildmode=plugin","Keep shared dependency versions identical between host and plugin modules","Only deploy on Linux; verify with 'file scanner.so' that it is an ELF shared object"],"tags":["go","plugin","build","shared-library"],"backgroundTag":"invalid-plugin-build","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"}