apache/beam · error

(peek) coder with id

Error message

(peek) coder with id %v not found

What it means

CoderUnmarshaller.peek looks up a coder component by its interned model id; the id was not present in the unmarshaller's models map. This means the pipeline model referenced a coder id that was never defined or was not interned before lookup. It indicates a malformed or incomplete coder reference graph.

Solutions

  1. Inspect the pipeline model and ensure every coder component id referenced exists in the coder components map
  2. Re-serialize the pipeline with the same SDK version rather than hand-editing the model
  3. Upgrade the Beam Go SDK if the pipeline came from a newer SDK that interns coders differently
  4. Check for bugs in custom code that builds pipepb.Coder messages directly
Defensive patterns

Strategy: validation

Validate before calling

// Validate the pipeline model before unmarshalling:
// every component id referenced by any coder exists in coderComponents
for id, c := range model.Components.Coders {
    for _, comp := range c.ComponentCoderIds {
        if _, ok := model.Components.Coders[comp]; !ok {
            return fmt.Errorf("dangling coder ref %s -> %s", id, comp)
        }
    }
}

Try / catch

// Catch and re-raise with the missing id context
if err != nil && strings.Contains(err.Error(), "not found") {
    return fmt.Errorf("pipeline model incomplete: %w", err)
}

Prevention

When it happens

Trigger: Resolving a nested/component coder by id during unmarshal when the pipeline model (CoderComponents) does not contain a definition for that id; corrupted or hand-assembled pipepb pipeline protos; isCoGBKList or makeCoder peeking an id absent from b.models.

Common situations: Pipelines serialized by another SDK omitting a component coder; truncated pipeline JSON; constructing pipepb.Coder protos manually with dangling component references.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at sdks/go/pkg/beam/core/runtime/graphx/coder.go:414

	// a general coder. Generally window coders are not used outside of
	// specific contexts, but this enables improved testing.
	// Window types are not permitted to be fulltypes, so
	// we use assignably equivalent anonymous struct types.
	case urnGlobalWindow:
		w, err := b.WindowCoder(id)
		if err != nil {
			return nil, errors.Errorf("could not unmarshal global window coder: %w", err)
		}
		return &coder.Coder{Kind: coder.Window, T: typex.New(reflect.TypeOf((*struct{})(nil)).Elem()), Window: w}, nil
	default:
		return nil, errors.Errorf("could not unmarshal coder from %v, unknown URN %v", c, urn)
	}
}

func (b *CoderUnmarshaller) peek(id string) (*pipepb.Coder, error) {
	c, ok := b.models[id]
	if !ok {
		return nil, errors.Errorf("(peek) coder with id %v not found", id)
	}
	return c, nil
}

func (b *CoderUnmarshaller) isCoGBKList(id string) ([]string, bool) {
	elm, err := b.peek(id)
	if err != nil {
		return nil, false
	}
	if elm.GetSpec().GetUrn() != urnLengthPrefixCoder {
		return nil, false
	}
	elm2, err := b.peek(elm.GetComponentCoderIds()[0])
	if err != nil {
		return nil, false
	}
	if elm2.GetSpec().GetUrn() != urnCoGBKList {
		return nil, false

View on GitHub (pinned to 12126d8942)