{"record":{"id":"aac3dafac759865b","repo":"router-for-me/CLIProxyAPI","slug":"plugin-call-s-returned-d-s-aac3da","errorCode":null,"errorMessage":"plugin call %s returned %d: %s","messagePattern":"plugin call (.+?) returned (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pluginhost/loader_windows.go","lineNumber":305,"sourceCode":"\t\tc.api.call,\n\t\tuintptr(unsafe.Pointer(methodBytes)),\n\t\trequestPtr,\n\t\tuintptr(len(request)),\n\t\tresponseMem,\n\t)\n\tvar out []byte\n\tif response.ptr != 0 && response.len > 0 {\n\t\tout = unsafe.Slice((*byte)(unsafe.Pointer(response.ptr)), response.len)\n\t\tout = append([]byte(nil), out...)\n\t}\n\tif response.ptr != 0 {\n\t\t_, _, _ = syscall.SyscallN(c.api.freeBuffer, response.ptr, response.len)\n\t}\n\tif rc != 0 {\n\t\tif isPluginErrorEnvelope(out) {\n\t\t\treturn out, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"plugin call %s returned %d: %s\", method, rc, string(out))\n\t}\n\treturn out, nil\n}\n\nfunc (c *dynamicLibraryClient) Shutdown() {\n\t// Windows Go DLLs are not safe to hot-unload from the host process.\n\t// The plugin was loaded from a shadow copy, so keeping the module mapped\n\t// does not block deleting or replacing the source artifact.\n\tc.close(false)\n}\n\nfunc (c *dynamicLibraryClient) closeAfterOpenFailure() {\n\tc.close(true)\n}\n\nfunc (c *dynamicLibraryClient) close(releaseDLL bool) {\n\tif c == nil {\n\t\treturn","sourceCodeStart":287,"sourceCodeEnd":323,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/pluginhost/loader_windows.go#L287-L323","documentation":"Windows version of the generic plugin-call failure: the plugin's call function returned a nonzero rc via syscall.SyscallN, and the output bytes were not a recognized plugin error envelope. The message includes the method name, the numeric return code, and the raw output string. The host frees the plugin's response buffer before reporting, so no leak occurs.","triggerScenarios":"Plugin method returns an error without the SDK error envelope; unknown method name dispatched to the DLL; plugin internal panic or abort returning nonzero; ABI-mismatched argument marshalling.","commonSituations":"Plugin and host built from different SDK revisions; method-name typos in custom dispatch glue; plugin crashing on malformed input bytes.","solutions":["Read the %s output — most plugins put their error text there","Confirm the method name matches the plugin's registered handlers exactly","Rebuild the plugin against the same pluginhost SDK version as the server","Reproduce with a minimal request payload to find the input the plugin chokes on"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"out, err := client.Call(ctx, method, body)\nif err != nil {\n    log.WithError(err).WithField(\"method\", method).Error(\"windows plugin rpc failed\")\n    return degradedResponse, nil // keep request alive if a fallback exists\n}","preventionTips":["Pin plugin and host to the same SDK version","Log method names on every dispatch","Test plugins with edge-case payloads before release"],"tags":["plugin","windows","rpc","dynamic-library"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}