{"record":{"id":"5b710e3083a26638","repo":"openzipkin/zipkin","slug":"trace-traceid-is-missing-a-timestamp","errorCode":null,"errorMessage":"Trace ${traceId} is missing a timestamp","messagePattern":"Trace (.+?) is missing a timestamp","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"zipkin-lens/src/zipkin/trace.js","lineNumber":74,"sourceCode":"// Returns null on empty or when missing a timestamp\nexport function traceSummary(root) {\n  const timestamps = [];\n  const groupedTimestamps = {};\n\n  let traceId;\n  let spanCount = 0;\n  let errorType = 'none';\n\n  root.traverse((span) => {\n    spanCount += 1;\n    traceId = span.traceId;\n    errorType = getErrorType(span, errorType);\n    addTimestamps(span, timestamps);\n    addServiceNameTimestampDuration(span, groupedTimestamps);\n  });\n\n  if (timestamps.length === 0)\n    throw new Error(`Trace ${traceId} is missing a timestamp`);\n\n  // If the first element does not exist, Error will be thrown.\n  // So we don't have to check rootSpan exisitence.\n  const [rootSpan] = root.queueRootMostSpans();\n  const rootServiceName =\n    getServiceName(rootSpan._span.localEndpoint) ||\n    getServiceName(rootSpan._span.remoteEndpoint) ||\n    'unknown';\n  const rootSpanName = rootSpan._span.name || 'unknown';\n\n  return {\n    traceId,\n    timestamp: timestamps[0],\n    duration: getMaxDuration(timestamps),\n    groupedTimestamps,\n    errorType,\n    spanCount,\n    root: {","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/openzipkin/zipkin/blob/878ce2a1fad54ca941d17fdcf2e1d924b148eb1f/zipkin-lens/src/zipkin/trace.js#L56-L92","documentation":"Thrown by zipkin-lens's trace summarizer (TreeBuilder→traceSummary path) when, after traversing every span in the tree, not a single span carried a timestamp. Span timestamps anchor the trace timeline; without at least one, the UI cannot compute a root timestamp, duration, or draw the trace waterfall.","triggerScenarios":"Building a trace summary from a span list where every span has timestamp undefined/null — e.g. client-reported spans that were never server-adjusted, or spans stripped of timestamps by instrumentation that only sets ids and names.","commonSituations":"Test fixtures with spans missing the timestamp field; async/local spans reported with no timestamp; data mangled by a proxy or serializer dropping numeric fields; spans from a tracer that defers clock capture and crashed before setting it.","solutions":["Ensure at least one span in each trace has a numeric timestamp (microseconds since epoch); normally every RPC span should have one.","Fix the reporting pipeline if timestamps are being dropped (check serialization, size limits, field renaming).","When constructing spans manually in tests, always set timestamp and duration."],"exampleFix":"// before\nconst spans = [{ traceId: 'a', id: 'a', name: 'root' }]; // no timestamp anywhere\ntraceSummary(spans); // throws 'Trace ... is missing a timestamp'\n\n// after\nconst spans = [{ traceId: 'a', id: 'a', name: 'root', timestamp: 1700000000000000, duration: 1000 }];\ntraceSummary(spans);","handlingStrategy":"validation","validationCode":"if (!spans.some((s) => typeof s.timestamp === 'number')) throw new Error('trace has no span with a timestamp');","typeGuard":"const hasTimestamp = (spans) => spans.some((s) => typeof s?.timestamp === 'number');","tryCatchPattern":null,"preventionTips":["Instrumentation must always set span.timestamp (microseconds) on reported spans.","Validate fixtures: every trace in test data has at least one timestamped span."],"tags":["zipkin","javascript","trace-data","timestamp"],"backgroundTag":null,"analyzedSha":"878ce2a1fad54ca941d17fdcf2e1d924b148eb1f","analyzedAt":"2026-08-14T15:17:09.895Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}