{"record":{"id":"0466ead0bcbff5f0","repo":"apache/beam","slug":"empty-pipeline","errorCode":null,"errorMessage":"empty pipeline","messagePattern":"empty pipeline","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/core/runtime/pipelinex/replace.go","lineNumber":58,"sourceCode":"\treflectx.UpdateMap(ret.Components.Pcollections, values.Pcollections)\n\treflectx.UpdateMap(ret.Components.WindowingStrategies, values.WindowingStrategies)\n\treflectx.UpdateMap(ret.Components.Coders, values.Coders)\n\treflectx.UpdateMap(ret.Components.Environments, values.Environments)\n\treturn Normalize(ret)\n}\n\n// IdempotentNormalize determines whether to use the idempotent version\n// of ensureUniqueNames or the legacy version.\n// TODO(BEAM-12341): Cleanup once nothing depends on the legacy implementation.\nvar IdempotentNormalize bool = true\n\n// Normalize recomputes derivative information in the pipeline, such\n// as roots and input/output for composite transforms. It also\n// ensures that unique names are so and topologically sorts each\n// subtransform list.\nfunc Normalize(p *pipepb.Pipeline) (*pipepb.Pipeline, error) {\n\tif len(p.GetComponents().GetTransforms()) == 0 {\n\t\treturn nil, errors.New(\"empty pipeline\")\n\t}\n\n\tret := shallowClonePipeline(p)\n\tif IdempotentNormalize {\n\t\tret.Components.Transforms = ensureUniqueNames(ret.Components.Transforms)\n\t} else {\n\t\tret.Components.Transforms = ensureUniqueNamesLegacy(ret.Components.Transforms)\n\t}\n\tret.Components.Transforms = computeCompositeInputOutput(ret.Components.Transforms)\n\tret.RootTransformIds = computeRoots(ret.Components.Transforms)\n\treturn ret, nil\n}\n\n// TrimCoders returns the transitive closure of the given coders ids.\nfunc TrimCoders(coders map[string]*pipepb.Coder, ids ...string) map[string]*pipepb.Coder {\n\tret := make(map[string]*pipepb.Coder)\n\tfor _, id := range ids {\n\t\twalkCoders(coders, ret, id)","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/core/runtime/pipelinex/replace.go#L40-L76","documentation":"Normalize validates that a pipeline proto has at least one transform before recomputing derivative information (roots, composite inputs/outputs, topological ordering). An empty Components.Transforms map cannot be meaningfully normalized, so it is rejected.","triggerScenarios":"Calling Normalize (directly or via Marshal, Update, or Expand) on a *pipepb.Pipeline whose components contain no transforms.","commonSituations":"Programmatic pipeline construction where transforms were never added before marshaling; deserializing a truncated or hand-crafted pipeline proto; cross-language payload construction mistakes.","solutions":["Ensure at least one transform is added to the pipeline before normalizing/marshaling","Verify the pipeline proto was constructed correctly if building it programmatically (use pipeline.New or the model pipelinex helpers)","Re-create the pipeline if it came from a corrupt or empty serialized source"],"exampleFix":"// before\np := &pipepb.Pipeline{Components: &pipepb.Components{}}\n_, err := pipelinex.Normalize(p)\n// after\nif len(p.GetComponents().GetTransforms()) == 0 {\n    return errors.New(\"pipeline has no transforms; construct it via beam.NewPipeline() before normalizing\")\n}\n_, err := pipelinex.Normalize(p)","handlingStrategy":"validation","validationCode":"if p == nil || len(p.GetComponents().GetTransforms()) == 0 {\n    return errors.New(\"cannot normalize: pipeline has no transforms\")\n}","typeGuard":null,"tryCatchPattern":"out, err := pipelinex.Normalize(p)\nif err != nil {\n    if strings.Contains(err.Error(), \"empty pipeline\") { return fmt.Errorf(\"pipeline was never populated with transforms\") }\n    return err\n}","preventionTips":["Build pipelines via beam.NewPipeline()/graph constructors rather than hand-made protos","Validate pipeline non-empty before marshal/update/expand","Verify serialized pipeline sources are complete","Round-trip test: normalize(Marshal(p)) in CI"],"tags":["go","apache-beam","pipeline-construction","validation"],"backgroundTag":"empty-required-field","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}