{"record":{"id":"66978bcdff6eb462","repo":"router-for-me/CLIProxyAPI","slug":"decode-host-model-stream-read-request-w","errorCode":null,"errorMessage":"decode host model stream read request: %w","messagePattern":"decode host model stream read request: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/pluginhost/host_model_stream_callbacks.go","lineNumber":58,"sourceCode":"\t\tcancel()\n\t\treturn nil, fmt.Errorf(\"host model stream bridge is unavailable\")\n\t}\n\tif req.HostCallbackID != \"\" {\n\t\th.addCallbackCleanup(req.HostCallbackID, func() {\n\t\t\th.modelStreams.close(streamID)\n\t\t})\n\t}\n\treturn marshalRPCResult(pluginapi.HostModelStreamResponse{\n\t\tStatusCode: stream.StatusCode,\n\t\tHeaders:    cloneHeader(stream.Headers),\n\t\tStreamID:   streamID,\n\t})\n}\n\nfunc (h *Host) callHostModelStreamRead(ctx context.Context, request []byte) ([]byte, error) {\n\tvar req pluginapi.HostModelStreamReadRequest\n\tif errUnmarshal := json.Unmarshal(request, &req); errUnmarshal != nil {\n\t\treturn nil, fmt.Errorf(\"decode host model stream read request: %w\", errUnmarshal)\n\t}\n\tif h == nil || h.modelStreams == nil {\n\t\treturn nil, fmt.Errorf(\"host model stream bridge is unavailable\")\n\t}\n\tchunk, done, errRead := h.modelStreams.read(ctx, req.StreamID)\n\tif errRead != nil {\n\t\treturn nil, errRead\n\t}\n\tresp := pluginapi.HostModelStreamReadResponse{\n\t\tPayload: append([]byte(nil), chunk.Payload...),\n\t\tDone:    done,\n\t}\n\tif chunk.Err != nil {\n\t\tresp.Error = chunk.Err.Error()\n\t\tresp.Done = true\n\t}\n\treturn marshalRPCResult(resp)\n}","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/pluginhost/host_model_stream_callbacks.go#L40-L76","documentation":"Error \"decode host model stream read request: %w\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/pluginhost/host_model_stream_callbacks.go:58 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Send a valid JSON stream read request with the correct stream id.","Fix the payload per the wrapped decode error."],"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"}