{"record":{"id":"17282bdb69f35abc","repo":"router-for-me/CLIProxyAPI","slug":"decode-host-auth-list-request-w","errorCode":null,"errorMessage":"decode host auth list request: %w","messagePattern":"decode host auth list request: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pluginhost/auth_callbacks.go","lineNumber":58,"sourceCode":"\th.mu.Unlock()\n}\n\nfunc (h *Host) currentAuthManager() *coreauth.Manager {\n\tif h == nil {\n\t\treturn nil\n\t}\n\th.mu.Lock()\n\tmanager := h.authManager\n\th.mu.Unlock()\n\treturn manager\n}\n\nfunc (h *Host) callHostAuthList(ctx context.Context, request []byte) ([]byte, error) {\n\t_ = ctx\n\tif len(bytesTrimSpace(request)) > 0 {\n\t\tvar req map[string]any\n\t\tif errUnmarshal := json.Unmarshal(request, &req); errUnmarshal != nil {\n\t\t\treturn nil, fmt.Errorf(\"decode host auth list request: %w\", errUnmarshal)\n\t\t}\n\t}\n\tentries, errList := h.listAuthFiles()\n\tif errList != nil {\n\t\treturn nil, errList\n\t}\n\treturn marshalRPCResult(rpcHostAuthListResponse{Files: entries})\n}\n\nfunc (h *Host) callHostAuthGet(ctx context.Context, request []byte) ([]byte, error) {\n\t_ = ctx\n\tvar req rpcHostAuthGetRequest\n\tif errUnmarshal := json.Unmarshal(request, &req); errUnmarshal != nil {\n\t\treturn nil, fmt.Errorf(\"decode host auth get request: %w\", errUnmarshal)\n\t}\n\tauthIndex := strings.TrimSpace(req.AuthIndex)\n\tif authIndex == \"\" {\n\t\treturn nil, fmt.Errorf(\"auth_index is required\")","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/pluginhost/auth_callbacks.go#L40-L76","documentation":"The host-side auth.list RPC callback received a request payload that is not valid JSON (or not a JSON object) and json.Unmarshal into map[string]any failed. The callback rejects the call before listing auth files; this is the plugin-to-host boundary validating its input.","triggerScenarios":"A plugin invoking the host 'auth list' RPC with a malformed payload — non-JSON bytes, a JSON array/scalar instead of an object, or a truncated frame from a broken IPC/stdio transport.","commonSituations":"Hand-written or third-party plugin sending the wrong RPC frame; plugin SDK version drift changing the wire format; stdio pipe corruption or partial writes between plugin process and host.","solutions":["Capture the exact payload bytes the plugin sends for the auth list call and validate them with a JSON linter","Update the plugin to use the current plugin SDK/protocol (empty object {} is valid; so is an empty body)","If using a custom transport, verify framing/length prefixes so payloads are not truncated","Restart the plugin process to re-establish a clean IPC channel if the stream got desynchronized"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// In the plugin, validate before sending the RPC:\nfunc validAuthListPayload(b []byte) bool {\n    if len(bytes.TrimSpace(b)) == 0 { return true } // empty is allowed\n    var probe map[string]any\n    return json.Unmarshal(b, &probe) == nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always json.Marshal structured requests instead of concatenating strings","Ship plugin and host from the same release so wire formats match","Add frame checksums/length prefixes on custom transports"],"tags":["plugin","rpc","json","validation"],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}