apache/beam · error

worker_id: ' ' read from context metadata but not…

Error message

worker_id: '%s' read from context metadata but not registered in worker pool

What it means

Error returned by MultiplexW.workerFromMetadataCtx when the worker_id read from gRPC context metadata is non-empty but no worker with that id exists in mw.pool. This means the SDK harness is reusing or replaying an id from a worker that has already been deleted/deregistered, or requests are hitting a different runner instance.

Solutions

  1. Ensure all requests from one SDK harness go to the same runner process that registered its worker
  2. Check that the worker hasn't been deregistered (e.g. after failure) before issuing further requests
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at sdks/go/pkg/beam/runners/prism/internal/worker/worker.go:817 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/85a9d57ec03752d6. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/runners/prism/internal/worker/worker.go:817

		mw.logger.Error(err.Error())
		return nil
	}
	return w.MonitoringMetadata(ctx, unknownIDs)
}

func (mw *MultiplexW) workerFromMetadataCtx(ctx context.Context) (*W, error) {
	mw.mu.Lock()
	defer mw.mu.Unlock()
	id, err := grpcx.ReadWorkerID(ctx)
	if err != nil {
		return nil, err
	}
	if id == "" {
		return nil, fmt.Errorf("worker_id read from context metadata is an empty string")
	}
	w, ok := mw.pool[id]
	if !ok {
		return nil, fmt.Errorf("worker_id: '%s' read from context metadata but not registered in worker pool", id)
	}
	return w, nil
}

func (mw *MultiplexW) delete(w *W) {
	mw.mu.Lock()
	defer mw.mu.Unlock()
	delete(mw.pool, w.ID)
}

// WaitForCleanUp waits until all resources relevant to the job are cleaned up.
func (mw *MultiplexW) WaitForCleanUp(id string) {
	mw.mu.Lock()
	wg := mw.wg[id]
	mw.mu.Unlock()
	if wg == nil {
		return
	}

View on GitHub (pinned to 12126d8942)