{"record":{"id":"9245db69dcde6382","repo":"shadow1ng/fscan","slug":"s-v-lasterror-d-minidump-snapshot-create-f","errorCode":null,"errorMessage":"%s: %v (LastError: %d) [minidump_snapshot_create_failed]","messagePattern":"(.+?): (.+?) \\(LastError: (.+?)\\) \\[minidump_snapshot_create_failed\\]","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/local/minidump.go","lineNumber":295,"sourceCode":"\t\treturn 0, err\n\t}\n\tdefer pm.closeHandle(snapshot)\n\n\treturn pm.findProcessInSnapshot(snapshot, name)\n}\n\n// createProcessSnapshot 创建进程快照\nfunc (pm *ProcessManager) createProcessSnapshot() (uintptr, error) {\n\tproc, err := pm.kernel32.FindProc(\"CreateToolhelp32Snapshot\")\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"%s: %w\", i18n.Tr(\"minidump_find_proc_failed\", \"CreateToolhelp32Snapshot\"), err)\n\t}\n\n\thandle, _, err := proc.Call(uintptr(TH32CS_SNAPPROCESS), 0)\n\tif handle == uintptr(INVALID_HANDLE_VALUE) {\n\t\tlastError := windows.GetLastError()\n\t\t//nolint:errorlint // Windows LastError不应该wrapped\n\t\treturn 0, fmt.Errorf(i18n.GetText(\"minidump_snapshot_create_failed\")+\": %v (LastError: %d)\", err, lastError)\n\t}\n\treturn handle, nil\n}\n\n// findProcessInSnapshot 在快照中查找进程\nfunc (pm *ProcessManager) findProcessInSnapshot(snapshot uintptr, name string) (uint32, error) {\n\tvar pe32 PROCESSENTRY32\n\tpe32.dwSize = uint32(unsafe.Sizeof(pe32))\n\n\tproc32First, err := pm.kernel32.FindProc(\"Process32FirstW\")\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"%s: %w\", i18n.Tr(\"minidump_find_proc_failed\", \"Process32FirstW\"), err)\n\t}\n\n\tproc32Next, err := pm.kernel32.FindProc(\"Process32NextW\")\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"%s: %w\", i18n.Tr(\"minidump_find_proc_failed\", \"Process32NextW\"), err)\n\t}","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/shadow1ng/fscan/blob/95cc12e753bf43de7004e5aef42a9ffba3934303/plugins/local/minidump.go#L277-L313","documentation":"Raised when CreateToolhelp32Snapshot returns INVALID_HANDLE_VALUE: the Windows API refused to build the process list (often insufficient privileges or non-interactive session); the raw error and GetLastError code are included un-wrapped.","triggerScenarios":"Thrown at plugins/local/minidump.go:295 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the scan process with elevated (admin) privileges","Check the LastError code to identify the specific API failure","Retry once — transient snapshot failures occur under heavy load"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"95cc12e753bf43de7004e5aef42a9ffba3934303","analyzedAt":"2026-09-06T17:07:30.094Z","contentChangedAt":"2026-09-06T17:07:30.094Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}