unslothai/unsloth · error · NativePathLeaseError
Native path grant timestamps are inconsistent.
Error message
Native path grant timestamps are inconsistent.
What it means
The backend rejected a signed native path grant because its issued_at_ms timestamp is greater than or equal to its expires_at_ms timestamp. Grants are HMAC-signed payloads produced by the Tauri desktop shell; the backend re-validates their internal consistency before trusting the lease. A grant whose issue time is not strictly before its expiry is treated as malformed or tampered with. This check runs before expiry or skew checks, so it fires even for grants that would otherwise still be valid time-wise.
Source
Thrown at studio/backend/utils/native_path_leases.py:330
"token_id_hash",
"issued_at_ms",
"expires_at_ms",
"nonce",
)
missing = [key for key in required if key not in payload]
if missing:
raise NativePathLeaseError("Native path grant payload is missing required fields.")
if _required_int(payload, "version") != 1:
raise NativePathLeaseError("Native path grant version is unsupported.")
if payload["operation"] != operation:
raise NativePathLeaseError("Native path grant operation is invalid.")
if expected_kind and payload["path_kind"] != expected_kind:
raise NativePathLeaseError("Native path grant kind is invalid.")
now_ms = int(time.time() * 1000)
issued_at_ms = _required_int(payload, "issued_at_ms")
expires_at_ms = _required_int(payload, "expires_at_ms")
if issued_at_ms >= expires_at_ms:
raise NativePathLeaseError("Native path grant timestamps are inconsistent.")
if expires_at_ms <= now_ms:
raise NativePathLeaseError("Native path grant has expired.")
if issued_at_ms > now_ms + 30_000:
raise NativePathLeaseError("Native path grant issue time is invalid.")
for key in ("canonical_path", "nonce", "token_id_hash", "display_label"):
raw = payload.get(key)
if raw is None:
continue
if "\x00" in str(raw):
raise NativePathLeaseError("Native path grant contains invalid characters.")
def _validate_current_stat(
grant: NativePathGrant, identity_options: tuple[tuple[int, int], ...]
) -> tuple[int, int] | None:
try:
st = os.lstat(grant.canonical_path)
except OSError as exc:View on GitHub (pinned to 203007d190)
Solutions
- Inspect the decoded payload: base64url-decode the first lease segment and compare issued_at_ms and expires_at_ms to confirm which is wrong.
- Fix the issuing side (Tauri/Rust signer) so expires_at_ms = issued_at_ms + ttl_ms with ttl_ms strictly positive (e.g. 5-10 minutes).
- If the grant came from a test harness, regenerate the fixture with issued_at_ms < expires_at_ms < issued_at_ms + max TTL.
- Request a fresh grant from the frontend after fixing the signer; old malformed grants cannot be repaired on the backend.
Example fix
// before (signer, Rust side)
let payload = json!({
"issued_at_ms": now_ms,
"expires_at_ms": now_ms, // TTL accidentally zero
...
});
// after
let ttl_ms: i64 = 10 * 60 * 1000;
let payload = json!({
"issued_at_ms": now_ms,
"expires_at_ms": now_ms + ttl_ms,
...
}); Defensive patterns
Strategy: validation
Validate before calling
import base64, json, time
def grant_timestamps_consistent(lease: str) -> bool:
payload = json.loads(base64.urlsafe_b64decode(lease.split('.')[0] + '=='))
return int(payload['issued_at_ms']) < int(payload['expires_at_ms']) Try / catch
try:
grant = verify_native_path_lease(lease, operation='read')
except NativePathLeaseError as exc:
if 'timestamps are inconsistent' in str(exc):
lease = refresh_grant() # re-pick; signer bug, report upstream
else:
raise Prevention
- Sign grants with expires_at_ms = issued_at_ms + positive TTL only.
- Unit-test the signer asserting issued_at_ms < expires_at_ms for every minted grant.
- Never hand-build timestamped payloads by copying one field from another.
When it happens
Trigger: verify_native_path_lease() is called with a lease whose decoded payload has issued_at_ms >= expires_at_ms. This happens when the Rust signer builds the payload with a zero/negative TTL, when clock fields are filled in the wrong order (expiry written into issued_at_ms), or when a hand-crafted payload is signed for testing with equal millisecond timestamps.
Common situations: A signer-version change that computes expires_at as issued_at + ttl_ms with ttl_ms=0 or negative; a test fixture reusing a static payload where both timestamps were copied from the same constant; tampering with the payload after signing (which normally fails HMAC first, but a cooperating signer can produce this).
Related errors
- Native path grant issue time is invalid.
- Native path grant is required.
- Native path grant has expired.
- Native path grant contains invalid characters.
- Native path grant has an unsupported path type.
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/2f277725992ec487.
Report an issue: GitHub.