router-for-me/CLIProxyAPI · error

decode host model stream read request: %w

Error message

decode host model stream read request: %w

What it means

Error "decode host model stream read request: %w" thrown in router-for-me/CLIProxyAPI.

Source

Thrown at internal/pluginhost/host_model_stream_callbacks.go:58

		cancel()
		return nil, fmt.Errorf("host model stream bridge is unavailable")
	}
	if req.HostCallbackID != "" {
		h.addCallbackCleanup(req.HostCallbackID, func() {
			h.modelStreams.close(streamID)
		})
	}
	return marshalRPCResult(pluginapi.HostModelStreamResponse{
		StatusCode: stream.StatusCode,
		Headers:    cloneHeader(stream.Headers),
		StreamID:   streamID,
	})
}

func (h *Host) callHostModelStreamRead(ctx context.Context, request []byte) ([]byte, error) {
	var req pluginapi.HostModelStreamReadRequest
	if errUnmarshal := json.Unmarshal(request, &req); errUnmarshal != nil {
		return nil, fmt.Errorf("decode host model stream read request: %w", errUnmarshal)
	}
	if h == nil || h.modelStreams == nil {
		return nil, fmt.Errorf("host model stream bridge is unavailable")
	}
	chunk, done, errRead := h.modelStreams.read(ctx, req.StreamID)
	if errRead != nil {
		return nil, errRead
	}
	resp := pluginapi.HostModelStreamReadResponse{
		Payload: append([]byte(nil), chunk.Payload...),
		Done:    done,
	}
	if chunk.Err != nil {
		resp.Error = chunk.Err.Error()
		resp.Done = true
	}
	return marshalRPCResult(resp)
}

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Send a valid JSON stream read request with the correct stream id.
  2. Fix the payload per the wrapped decode error.

When it happens

Trigger: Thrown at internal/pluginhost/host_model_stream_callbacks.go:58 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15). Data as JSON: /api/errors/66978bcdff6eb462. Report an issue: GitHub.