{
  "id": "data/timestamp-epoch-millis-vs-seconds",
  "signature": "Timestamp deserialization fails because epoch is in milliseconds but expected in seconds",
  "signature_zh": "时间戳反序列化失败，因为纪元以毫秒为单位但预期是秒",
  "regex": "Timestamp deserialization fails because epoch is in milliseconds but expected in seconds",
  "domain": "data",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "The data source provides timestamps as Unix epoch milliseconds (e.g., 1700000000000) but the deserializer expects seconds (e.g., 1700000000), causing overflow or incorrect dates.",
  "root_cause_type": "generic",
  "root_cause_zh": "数据源提供Unix纪元毫秒的时间戳（如1700000000000），但反序列化器期望秒（如1700000000），导致溢出或错误日期。",
  "versions": [
    {
      "version": "Apache Kafka 3.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Python datetime 3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Java 17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Dividing by 1000 in code may cause integer overflow if the timestamp is stored as a 32-bit integer.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Assuming all timestamps are in milliseconds may break when some sources use seconds.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Detect the unit by checking the magnitude: if timestamp > 1e12, treat as milliseconds and divide by 1000. Example in Python: `if ts > 1e12: ts /= 1000`.",
      "success_rate": 0.95,
      "how": "Detect the unit by checking the magnitude: if timestamp > 1e12, treat as milliseconds and divide by 1000. Example in Python: `if ts > 1e12: ts /= 1000`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Configure the deserializer to expect milliseconds explicitly, e.g., in Kafka Connect: `timestamp.converter=org.apache.kafka.connect.json.JsonConverter` with `converter.type=timestamp` and `converter.format=epoch.millis`.",
      "success_rate": 0.85,
      "how": "Configure the deserializer to expect milliseconds explicitly, e.g., in Kafka Connect: `timestamp.converter=org.apache.kafka.connect.json.JsonConverter` with `converter.type=timestamp` and `converter.format=epoch.millis`.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Detect the unit by checking the magnitude: if timestamp > 1e12, treat as milliseconds and divide by 1000. Example in Python: `if ts > 1e12: ts /= 1000`.",
    "Configure the deserializer to expect milliseconds explicitly, e.g., in Kafka Connect: `timestamp.converter=org.apache.kafka.connect.json.JsonConverter` with `converter.type=timestamp` and `converter.format=epoch.millis`."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html",
  "official_doc_section": null,
  "error_code": "TIMESTAMP_EPOCH_UNIT_MISMATCH",
  "verification_tier": "ai_generated",
  "confidence": 0.89,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-06-22",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}