apache/beam · error

unable to find dependency with

Error message

unable to find dependency with %q role in environment with ID %q,

What it means

After finding the default Go environment, UpdateDefaultEnvWorkerType iterates its dependencies looking for one with the Go worker role URN to overwrite with the new artifact type/payload. This error is thrown when the environment exists but contains no dependency carrying URNArtifactGoWorkerRole.

Solutions

  1. Verify the Go environment includes the artifact dependency with the Go worker role URN (URNArtifactGoWorkerRole).
  2. Rebuild the pipeline with the stock Go SDK environment rather than a hand-constructed one.
  3. Add the dependency with the correct role URN to the environment before calling UpdateDefaultEnvWorkerType.

Example fix

// before
// env built manually without role-tagged deps
env := pipepb.NewEnvironment(...)
// after
deps = append(deps, &pipepb.ArtifactDependency{
    TypeUrn: graphx.URNArtifactFileType,
    RoleUrn: graphx.URNArtifactGoWorkerRole,
})
env.Dependencies = deps
Defensive patterns

Strategy: validation

Validate before calling

for _, dep := range env.GetDependencies() {
    if dep.GetRoleUrn() == graphx.URNArtifactGoWorkerRole {
        return nil // ok
    }
}
return errors.New("environment lacks Go worker role dependency")

Try / catch

if err := graphx.UpdateDefaultEnvWorkerType(urn, payload, pipe); err != nil {
    log.Fatalf("no Go worker role dependency: %v", err)
}

Prevention

When it happens

Trigger: Calling UpdateDefaultEnvWorkerType on a pipeline whose default Go environment's dependency list has no entry with RoleUrn == URNArtifactGoWorkerRole (loop falls through without returning).

Common situations: Custom environment construction omitted the Go worker artifact dependency; a preprocessing step stripped or re-tagged dependencies; cross-language merging replaced the environment contents.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


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

Appendix: source

Thrown at sdks/go/pkg/beam/core/runtime/graphx/translate.go:1520

// UpdateDefaultEnvWorkerType is so runners can update the pipeline's default environment
// with the correct artifact type and payload for the Go worker binary.
func UpdateDefaultEnvWorkerType(typeUrn string, pyld []byte, p *pipepb.Pipeline) error {
	// Get the Go environment out.
	envs := p.GetComponents().GetEnvironments()
	env, ok := envs[defaultEnvId]
	if !ok {
		return errors.Errorf("unable to find default Go environment with ID %q", defaultEnvId)
	}
	for _, dep := range env.GetDependencies() {
		if dep.RoleUrn != URNArtifactGoWorkerRole {
			continue
		}
		dep.TypeUrn = typeUrn
		dep.TypePayload = pyld
		return nil
	}
	return errors.Errorf("unable to find dependency with %q role in environment with ID %q,", URNArtifactGoWorkerRole, defaultEnvId)
}

// UserStateCoderID returns the coder id of a user state
func UserStateCoderID(ps state.PipelineState) string {
	return fmt.Sprintf("val_%v", ps.StateKey())
}

// UserStateKeyCoderID returns the key coder id of a user state
func UserStateKeyCoderID(ps state.PipelineState) string {
	return fmt.Sprintf("key_%v", ps.StateKey())
}

View on GitHub (pinned to 12126d8942)