{"record":{"id":"52455b92412b92e4","repo":"router-for-me/CLIProxyAPI","slug":"allocate-host-api","errorCode":null,"errorMessage":"allocate host api","messagePattern":"allocate host api","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pluginhost/loader_unix.go","lineNumber":131,"sourceCode":"\tdefer C.free(unsafe.Pointer(cPath))\n\n\thandle := C.cliproxy_dlopen(cPath)\n\tif handle == nil {\n\t\treturn nil, fmt.Errorf(\"dlopen %s: %s\", file.Path, dlerrorString())\n\t}\n\n\tcSymbol := C.CString(\"cliproxy_plugin_init\")\n\tinitSymbol := C.cliproxy_dlsym(handle, cSymbol)\n\tC.free(unsafe.Pointer(cSymbol))\n\tif initSymbol == nil {\n\t\tC.cliproxy_dlclose(handle)\n\t\treturn nil, fmt.Errorf(\"missing cliproxy_plugin_init: %s\", dlerrorString())\n\t}\n\n\thostAPI := (*C.cliproxy_host_api)(C.malloc(C.size_t(unsafe.Sizeof(C.cliproxy_host_api{}))))\n\tif hostAPI == nil {\n\t\tC.cliproxy_dlclose(handle)\n\t\treturn nil, fmt.Errorf(\"allocate host api\")\n\t}\n\thostCtx := C.malloc(C.size_t(unsafe.Sizeof(C.uintptr_t(0))))\n\tif hostCtx == nil {\n\t\tC.free(unsafe.Pointer(hostAPI))\n\t\tC.cliproxy_dlclose(handle)\n\t\treturn nil, fmt.Errorf(\"allocate host context\")\n\t}\n\tid := hostCallbackID.Add(1)\n\t*(*C.uintptr_t)(hostCtx) = C.uintptr_t(id)\n\thostCallbackEntries.Store(id, dynamicHostCallbackEntry{host: host, pluginID: file.ID})\n\tC.cliproxy_set_host_api(hostAPI, C.uint32_t(pluginHostABIVersion), hostCtx)\n\n\tclient := &dynamicLibraryClient{\n\t\thandle:  handle,\n\t\thostAPI: hostAPI,\n\t\thostCtx: hostCtx,\n\t}\n\trc := C.cliproxy_call_init(initSymbol, hostAPI, &client.api)","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/pluginhost/loader_unix.go#L113-L149","documentation":"Error \"allocate host api\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/pluginhost/loader_unix.go:131 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check host memory availability; the host API allocation failed.","Restart the server if the allocation failure persists."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}