wavetermdev/waveterm · error
procinfo: Process32Next: %w
Error message
procinfo: Process32Next: %w
What it means
During snapshot iteration, Process32Next advances to the next process entry; ERROR_NO_MORE_FILES is the expected clean end of iteration and breaks the loop, but any other error is wrapped in this error. It means iteration aborted mid-scan and the returned snapshot would be incomplete, so it is discarded.
Source
Thrown at pkg/util/procinfo/procinfo_windows.go:72
var entry windows.ProcessEntry32
entry.Size = uint32(unsafe.Sizeof(entry))
if err := windows.Process32First(snap, &entry); err != nil {
return nil, fmt.Errorf("procinfo: Process32First: %w", err)
}
for {
pid := int32(entry.ProcessID)
procs[pid] = &snapInfo{
ppid: entry.ParentProcessID,
numThreads: entry.Threads,
exeName: windows.UTF16ToString(entry.ExeFile[:]),
}
if err := windows.Process32Next(snap, &entry); err != nil {
if errors.Is(err, windows.ERROR_NO_MORE_FILES) {
break
}
return nil, fmt.Errorf("procinfo: Process32Next: %w", err)
}
}
return &windowsSnapshot{procs: procs}, nil
}
// GetProcInfo returns a ProcInfo for the given pid.
// snap must be a non-nil value returned by MakeGlobalSnapshot.
// Returns nil, nil if the pid is not present in the snapshot.
func GetProcInfo(_ context.Context, snap any, pid int32) (*ProcInfo, error) {
if snap == nil {
return nil, fmt.Errorf("procinfo: GetProcInfo requires a snapshot on windows")
}
ws, ok := snap.(*windowsSnapshot)
if !ok {
return nil, fmt.Errorf("procinfo: invalid snapshot type")
}
si, found := ws.procs[pid]View on GitHub (pinned to a4447c1563)
Solutions
- Confirm the wrapped error is not ERROR_NO_MORE_FILES (library already filters that as normal termination)
- Retry MakeGlobalSnapshot — most mid-iteration failures are transient
- Check EDR/AV logs for interference with toolhelp32 APIs and whitelist the binary
- Close other snapshot handles promptly; avoid holding many snapshots concurrently
Example fix
// after (caller tolerance for partial failures)
snap, err := procinfo.MakeGlobalSnapshot()
if err != nil {
if strings.Contains(err.Error(), "Process32Next") {
log.Warn("partial snapshot failure, retrying", "err", err)
snap, err = procinfo.MakeGlobalSnapshot()
}
if err != nil {
return err
}
} Defensive patterns
Strategy: retry
Try / catch
snap, err := procinfo.MakeGlobalSnapshot()
if err != nil {
if strings.Contains(err.Error(), "Process32Next") {
snap, err = procinfo.MakeGlobalSnapshot()
}
if err != nil { return err }
} Prevention
- Whitelist your binary with EDR/AV products that hook toolhelp APIs
- Retry enumeration when mid-iteration errors occur
- Close snapshots promptly; avoid holding many concurrently
- Log the wrapped error code to distinguish access-denied from corruption
When it happens
Trigger: MakeGlobalSnapshot when windows.Process32Next returns an error other than windows.ERROR_NO_MORE_FILES — typically ERROR_ACCESS_DENIED from EDR/AV interference or a corrupted snapshot handle mid-iteration.
Common situations: Security software terminating snapshot enumeration; processes churning so fast the snapshot handle becomes invalid; handle corruption in long-running services making thousands of snapshots.
Related errors
- procinfo: CreateToolhelp32Snapshot: %w
- procinfo: Process32First: %w
- --pid flag is not supported on Windows
- failed to create WSL command
- failed to start command: %w
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/2b2cffd9a8e228f1.
Report an issue: GitHub.