router-for-me/CLIProxyAPI · error
allocate plugin response buffer
Error message
allocate plugin response buffer
What it means
LocalAlloc for the plugin response buffer returned NULL without setting a retrievable error (errAlloc == nil but responseMem == 0). Functionally identical to error 569: the host could not allocate the small fixed-size response struct, so the plugin call is abandoned before it starts.
Source
Thrown at internal/pluginhost/loader_windows.go:280
}
}
methodBytes, errMethod := syscall.BytePtrFromString(method)
if errMethod != nil {
return nil, errMethod
}
var requestPtr uintptr
if len(request) > 0 {
requestPtr = uintptr(unsafe.Pointer(&request[0]))
}
responseMem, errAlloc := windows.LocalAlloc(
windows.LMEM_FIXED|windows.LMEM_ZEROINIT,
uint32(unsafe.Sizeof(windowsBuffer{})),
)
if errAlloc != nil {
return nil, fmt.Errorf("allocate plugin response buffer: %w", errAlloc)
}
if responseMem == 0 {
return nil, fmt.Errorf("allocate plugin response buffer")
}
defer func() {
_, _ = windows.LocalFree(windows.Handle(responseMem))
}()
response := (*windowsBuffer)(unsafe.Pointer(responseMem))
rc, _, _ := syscall.SyscallN(
c.api.call,
uintptr(unsafe.Pointer(methodBytes)),
requestPtr,
uintptr(len(request)),
responseMem,
)
var out []byte
if response.ptr != 0 && response.len > 0 {
out = unsafe.Slice((*byte)(unsafe.Pointer(response.ptr)), response.len)
out = append([]byte(nil), out...)
}
if response.ptr != 0 {View on GitHub (pinned to 78f0c4079e)
Solutions
- Restart the process to restore a healthy heap, then investigate what exhausted memory
- Profile or monitor RSS of the server; cap plugin concurrency
- If recurring, capture a memory dump at failure time
Defensive patterns
Strategy: retry
Try / catch
if err != nil && strings.Contains(err.Error(), "allocate plugin response buffer") {
err = retryOnce(client.Call, ctx, method, body)
} Prevention
- Investigate memory leaks if this recurs — a NULL LocalAlloc signals heap/commit exhaustion
- Bound plugin concurrency
When it happens
Trigger: Severe memory exhaustion where LocalAlloc returns NULL; corrupted heap in the host process; extremely constrained sandboxed environments.
Common situations: Long-running process degradation; memory leaks elsewhere in the process; system commit limit reached.
Related errors
- allocate plugin response buffer: %w
- cliproxy_plugin_init returned %d: %v
- plugin ABI version %d is not supported
- plugin function table is incomplete
- remove stale shadow plugin: %w
AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15).
Data as JSON: /api/errors/5c1a0623adcc7468.
Report an issue: GitHub.