apache/beam · error

unable to generate schema uuid for

Error message

unable to generate schema uuid for %s, wrote out %d bytes, want %d: err %v

What it means

getUUID derives a stable schema UUID by hashing the type's string name with FNV-128a. It panics if hasher.Write reports an error or writes a different number of bytes than the typename length — a defensive check that should be practically unreachable in Go.

Solutions

  1. Retry the operation; the failure is transient at worst
  2. Check system memory availability
  3. Report to Beam if reproducible, since FNV Write is not expected to fail
Defensive patterns

Strategy: try-catch

Try / catch

defer func() { if r := recover(); r != nil { err = fmt.Errorf("schema uuid generation failed: %v", r) } }()

Prevention

When it happens

Trigger: Any call path through fromType or structToSchema that computes a UUID; the panic fires only if fnv hash Write fails or short-writes, which essentially indicates memory/allocation failure or a corrupted hasher.

Common situations: Systemic memory pressure or OOM conditions during schema registration; this is nearly always an internal invariant failure rather than user error.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at sdks/go/pkg/beam/core/runtime/graphx/schema/schema.go:83

// the default schema registry.
func Registered(ut reflect.Type) bool {
	return defaultRegistry.Registered(ut)
}

// RegisterType converts the type to it's schema representation, and converts it back to
// a synthetic type so we can map from the synthetic type back to the user type.
// Recursively registers other named struct types in any component parts.
func RegisterType(ut reflect.Type) {
	defaultRegistry.RegisterType(ut)
}

// getUUID generates a UUID using the string form of the type name.
func getUUID(ut reflect.Type) string {
	// String produces non-empty output for pointer and slice types.
	typename := ut.String()
	hasher := fnv.New128a()
	if n, err := hasher.Write([]byte(typename)); err != nil || n != len(typename) {
		panic(fmt.Sprintf("unable to generate schema uuid for %s, wrote out %d bytes, want %d: err %v", typename, n, len(typename), err))
	}
	id, err := uuid.NewRandomFromReader(bytes.NewBuffer(hasher.Sum(nil)))
	if err != nil {
		panic(fmt.Sprintf("unable to genereate schema uuid for type %s: %v", typename, err))
	}
	return id.String()
}

// Registered returns whether the given type has been registered with
// the schema package.
func (r *Registry) Registered(ut reflect.Type) bool {
	r.reconcileRegistrations()
	r.rwmu.RLock()
	defer r.rwmu.RUnlock()
	_, ok := r.syntheticToUser[ut]
	return ok
}

View on GitHub (pinned to 12126d8942)