router-for-me/CLIProxyAPI · error

http stream id is required

Error message

http stream id is required

What it means

Error "http stream id is required" thrown in router-for-me/CLIProxyAPI.

Solutions

  1. Include the stream id returned when the HTTP stream was opened.
  2. Verify the plugin tracks open stream ids correctly.

When it happens

Trigger: Thrown at internal/pluginhost/http_stream_bridge.go:44 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/26d50c4e2024653b. Report an issue: GitHub.

Appendix: source

Thrown at internal/pluginhost/http_stream_bridge.go:44

}

func (b *hostHTTPStreamBridge) open(chunks <-chan pluginapi.HTTPStreamChunk, cancel context.CancelFunc) string {
	if b == nil || chunks == nil {
		if cancel != nil {
			cancel()
		}
		return ""
	}
	id := strconv.FormatUint(b.next.Add(1), 10)
	b.mu.Lock()
	b.streams[id] = hostHTTPStreamEntry{chunks: chunks, cancel: cancel}
	b.mu.Unlock()
	return id
}

func (b *hostHTTPStreamBridge) read(ctx context.Context, id string) (pluginapi.HTTPStreamChunk, bool, error) {
	if b == nil || id == "" {
		return pluginapi.HTTPStreamChunk{}, true, fmt.Errorf("http stream id is required")
	}
	b.mu.Lock()
	entry := b.streams[id]
	b.mu.Unlock()
	if entry.chunks == nil {
		return pluginapi.HTTPStreamChunk{}, true, fmt.Errorf("http stream %s is not open", id)
	}
	if ctx == nil {
		ctx = context.Background()
	}
	select {
	case <-ctx.Done():
		b.close(id)
		return pluginapi.HTTPStreamChunk{}, true, ctx.Err()
	case chunk, ok := <-entry.chunks:
		if !ok {
			b.close(id)
			return pluginapi.HTTPStreamChunk{}, true, nil

View on GitHub (pinned to 78f0c4079e)