{"record":{"id":"c47e3e3f60d7ca10","repo":"apache/beam","slug":"could-not-translate-the-internal-step-name-v","errorCode":null,"errorMessage":"could not translate the internal step name %v","messagePattern":"could not translate the internal step name (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"sdks/go/pkg/beam/runners/dataflow/dataflowlib/metrics.go","lineNumber":87,"sourceCode":"\t}\n\treturn counters, distributions\n}\n\nfunc extractKey(metric *df.MetricUpdate, p *pipepb.Pipeline) (metrics.StepKey, error) {\n\tstepName, ok := metric.Name.Context[\"step\"]\n\tif !ok {\n\t\treturn metrics.StepKey{}, fmt.Errorf(\"could not find the internal step name\")\n\t}\n\tuserStepName := \"\"\n\n\tfor k, transform := range p.GetComponents().GetTransforms() {\n\t\tif k == stepName {\n\t\t\tuserStepName = transform.GetUniqueName()\n\t\t\tbreak\n\t\t}\n\t}\n\tif userStepName == \"\" {\n\t\treturn metrics.StepKey{}, fmt.Errorf(\"could not translate the internal step name %v\", stepName)\n\t}\n\n\tnamespace := metric.Name.Context[\"namespace\"]\n\tif namespace == \"\" {\n\t\tnamespace = \"dataflow/v1b3\"\n\t}\n\n\treturn metrics.StepKey{Step: userStepName, Name: metric.Name.Name, Namespace: namespace}, nil\n}\n\nfunc extractCounterValue(obj any) (int64, error) {\n\tv, ok := obj.(float64)\n\tif !ok {\n\t\treturn -1, fmt.Errorf(\"expected float64, got data of type %T instead\", obj)\n\t}\n\treturn int64(v), nil\n}\n","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/dataflow/dataflowlib/metrics.go#L69-L105","documentation":"extractKey maps an internal Dataflow step name to the user-facing transform UniqueName by scanning the pipeline's components. This error means the metric referenced step context that does not match any transform ID in the pipeline proto, so the internal name cannot be translated to a user-visible step name.","triggerScenarios":"A MetricUpdate's \"step\" context value names a step that is absent from pipepb.Pipeline components — e.g. metrics for steps removed/rewritten during Dataflow service-side optimization, or a stale pipeline object passed to groupByType.","commonSituations":"Fetching metrics after the Dataflow service merged or optimized steps so internal IDs no longer match the submitted pipeline proto; passing the wrong/older pipeline object to the metrics extraction function.","solutions":["Verify the *pipepb.Pipeline passed to groupByType is the exact pipeline submitted for the job whose metrics are being read","Skip/log metrics whose step cannot be resolved instead of failing the extraction","Log the unmatched stepName and compare with the Dataflow job graph via the console/API to confirm service-side step rewriting"],"exampleFix":"// before\nif userStepName == \"\" {\n    return metrics.StepKey{}, fmt.Errorf(\"could not translate the internal step name %v\", stepName)\n}\n// after\nif userStepName == \"\" {\n    return metrics.StepKey{}, fmt.Errorf(\"could not translate the internal step name %q (service may have optimized steps)\", stepName)\n}","handlingStrategy":"fallback","validationCode":"transforms := pipeline.GetComponents().GetTransforms()\nif _, ok := transforms[stepName]; !ok {\n    // stale/optimized step; skip metric\n    continue\n}","typeGuard":null,"tryCatchPattern":"key, err := extractKey(mu, pipeline)\nif err != nil {\n    log.Printf(\"unresolved step %q: %v\", stepName, err)\n    continue\n}","preventionTips":["Use the exact pipeline proto submitted for the job when extracting metrics","Treat metrics for unknown steps as skippable (Dataflow may optimize/merge steps)","Map steps via the Dataflow job graph API when protos diverge"],"tags":["dataflow","go","metrics"],"backgroundTag":"entity-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}