{"record":{"id":"d03cfafb3ab02af4","repo":"apache/beam","slug":"unknown-metric-type-spec-metrictype","errorCode":null,"errorMessage":"Unknown metric type: ${spec.metricType}","messagePattern":"Unknown metric type: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"sdks/typescript/src/apache_beam/worker/metrics.ts","lineNumber":295,"sourceCode":"        .filter((metric) => metric.is_set)\n        .map((metric) => [\n          shortIdCache.getShortId(metric),\n          metric.value.payload(),\n        ]),\n    );\n  }\n\n  reset(): void {\n    for (const [_, cell] of this.metrics) {\n      cell.reset();\n    }\n  }\n}\n\nfunction createMetric(spec: MetricSpec): MetricCell<unknown> {\n  const constructor = metricTypes.get(spec.metricType);\n  if (constructor === undefined) {\n    throw new Error(\"Unknown metric type: \" + spec.metricType);\n  }\n  return constructor(spec);\n}\n\nexport class MetricsShortIdCache {\n  private idToInfo = new Map<string, MonitoringInfo>();\n  private keyToId = new Map<string, string>();\n\n  getShortId(metric: ScopedMetricCell<unknown>): string {\n    var shortId = this.keyToId.get(metric.key);\n    if (shortId === undefined) {\n      shortId = \"m\" + this.keyToId.size;\n      this.idToInfo.set(shortId, metric.toEmptyMonitoringInfo());\n      this.keyToId.set(metric.key, shortId);\n    }\n    return shortId;\n  }\n","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/typescript/src/apache_beam/worker/metrics.ts#L277-L313","documentation":"createMetric looked up spec.metricType in the metricTypes registry (the map of supported MonitoringInfo metric types to MetricCell constructors) and found no entry. The metricType string on the MetricSpec is the input at fault: the runner sent or the SDK produced a metric kind this worker cannot instantiate.","triggerScenarios":"Thrown at sdks/typescript/src/apache_beam/worker/metrics.ts:295 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Compare the printed metricType against the keys registered in metricTypes and fix whichever side (runner protocol or SDK version) is out of date.","Upgrade the TypeScript SDK so newly defined metric types are recognized.","Filter unknown specs before calling getMetric if you control the producer and only known types matter."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}