router-for-me/CLIProxyAPI · error

host model stream bridge is unavailable

Error message

host model stream bridge is unavailable

What it means

Error "host model stream bridge is unavailable" thrown in router-for-me/CLIProxyAPI.

Source

Thrown at internal/pluginhost/host_model_stream_callbacks.go:41

	skipPluginID := h.callbackCallerPluginID(ctx, req.HostCallbackID)
	callbackCtx := h.resolveCallbackContext(req.HostCallbackID, ctx)
	if callbackCtx == nil {
		callbackCtx = context.Background()
	}
	// Detach request cancellation while preserving callback values; callback cleanup owns the model stream lifetime.
	streamCtx, cancel := context.WithCancel(context.WithoutCancel(callbackCtx))
	stream, errMsg := executor.ExecuteModelStream(streamCtx, modelExecutionRequestFromPlugin(req.HostModelExecutionRequest, skipPluginID))
	if errMsg != nil {
		cancel()
		return nil, modelExecutionError(errMsg)
	}
	streamID := ""
	if h.modelStreams != nil {
		streamID = h.modelStreams.open(req.HostCallbackID, stream.Chunks, cancel)
	}
	if streamID == "" {
		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)
	}

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Ensure the model stream bridge is registered before plugins request streams.
  2. Check plugin host initialization for the stream bridge setup.

When it happens

Trigger: Thrown at internal/pluginhost/host_model_stream_callbacks.go:41 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/cc16a0401e3988b4. Report an issue: GitHub.