{"record":{"id":"7d8d4a2c924f27d5","repo":"nautechsystems/nautilus_trader","slug":"value-must-not-be-none","errorCode":null,"errorMessage":"value must not be None","messagePattern":"value must not be None","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/nautilus_trader/core/datetime.py","lineNumber":86,"sourceCode":"    try:\n        import pandas as pd\n    except ImportError:\n        seconds, nanos_remainder = divmod(int(nanos), _NANOS_PER_SECOND)\n        microseconds, nanos_remainder = divmod(nanos_remainder, _NANOS_PER_MICROSECOND)\n        if nanos_remainder:\n            raise ValueError(\"pandas is required for nanosecond-precision datetimes\") from None\n\n        return _UNIX_EPOCH + timedelta(seconds=seconds, microseconds=microseconds)\n\n    return pd.Timestamp(int(nanos), unit=\"ns\", tz=\"UTC\")\n\n\ndef dt_to_unix_nanos(value: int | str | datetime | pd.Timestamp | None) -> int:\n    \"\"\"\n    Return the UNIX timestamp in nanoseconds for the given datetime-like value.\n    \"\"\"\n    if value is None:\n        raise ValueError(\"value must not be None\")\n\n    try:\n        import pandas as pd\n    except ImportError:\n        if isinstance(value, int):\n            return value\n        if isinstance(value, str):\n            if _has_more_than_microsecond_precision(value):\n                raise ValueError(\"pandas is required for nanosecond-precision datetimes\") from None\n            value = datetime.fromisoformat(value)\n        if isinstance(value, datetime):\n            return _datetime_to_unix_nanos(value)\n        raise TypeError(\"value must be datetime-like\") from None\n\n    if isinstance(value, pd.Timestamp):\n        return int(value.value)\n\n    return int(pd.Timestamp(value).value)","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/python/nautilus_trader/core/datetime.py#L68-L104","documentation":"Sentinel guard at the top of dt_to_unix_nanos: the signature admits None only for typing convenience, and a None value has no meaningful nanosecond representation, so it is rejected before any conversion is attempted.","triggerScenarios":"Thrown at python/nautilus_trader/core/datetime.py:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an int, ISO-8601 string, datetime, or pd.Timestamp","Check for None at the call site and supply a concrete timestamp instead"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}