apache/beam · error

No type registered %s

Error message

No type registered %s

What it means

datastoreio serializes entities using Beam's coder registration: each element must carry a registered Go type so it can be encoded/decoded as a datastore property. ProcessElement calls runtime.LookupType(s.Type) with the type name recorded in the sink payload, and throws this error when that name isn't in the global type registry. This usually means the type was never registered via reflect.TypeOf(T{}).Name() registration or the name string is stale/wrong.

Source

Thrown at sdks/go/pkg/beam/io/datastoreio/datastore.go:243

	client, err := s.newClientFunc(ctx, s.Project)
	if err != nil {
		return err
	}
	defer client.Close()

	// deserialize Query
	var k string
	v(&k)
	q := BoundedQuery{}
	err = json.Unmarshal([]byte(k), &q)
	if err != nil {
		return err
	}

	// lookup type
	t, ok := runtime.LookupType(s.Type)
	if !ok {
		return errors.Errorf("No type registered %s", s.Type)
	}

	// Translate BoundedQuery to datastore.Query
	dq := datastore.NewQuery(s.Kind)
	if q.Start != nil {
		dq = dq.Filter("__key__ >=", q.Start)
	}
	if q.End != nil {
		dq = dq.Filter("__key__ <", q.End)
	}

	// Run Query
	iter := client.Run(ctx, dq)
	for {
		val := reflect.New(t).Interface() // val : *T
		if _, err := iter.Next(val); err != nil {
			if err == iterator.Done {
				break

View on GitHub (pinned to 12126d8942)

Solutions

  1. Verify the type name stored in the payload matches the currently compiled struct and re-register it (via beam's reflection registration, e.g. in init())
  2. Rebuild/redeploy the worker so the binary contains the same type names as the pipeline that wrote the data
  3. If the struct was renamed, migrate existing datastore payloads to the new type name or add a registration alias
  4. Check for version skew between pipeline submission and worker container images

Example fix

// before
// type was renamed but registration removed
func init() { /* nothing */ }
// after
type UserEntity struct{ ... }
func init() {
    beam.RegisterType(reflect.TypeOf((*UserEntity)(nil)).Elem())
}
Defensive patterns

Strategy: try-catch

Validate before calling

func isTypeRegistered(t reflect.Type) bool {
    _, ok := runtime.LookupType(t.Name())
    return ok
}

Try / catch

if err := datastoreio.Write(scope, store, entity); err != nil {
    if strings.Contains(err.Error(), "No type registered") {
        log.Fatalf("type not registered: ensure beam.RegisterType is called in init(): %v", err)
    }
    return err
}

Prevention

When it happens

Trigger: Writing entities with datastoreio.Write when the element's registered type name does not match what's in the registry — e.g. the type name embedded in the payload refers to a type from a different binary/version, the registration call was removed, or the struct was renamed/refactored between pipeline submission and worker execution.

Common situations: Renaming a Go struct after building the pipeline so stored/serialized type names no longer resolve; running workers with a different binary version than the one that registered the types; forgetting to keep the init()-time type registration in the worker binary; using custom types not registered with Beam's reflection registry.

Related errors


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