unslothai/unsloth · error · NativePathLeaseError
Native path grant payload is missing required fields.
Error message
Native path grant payload is missing required fields.
What it means
The decoded payload object is missing one or more of the required fields: version, operation, canonical_path, path_kind, path_type, source_kind, token_id_hash, issued_at_ms, expires_at_ms, or nonce (also raised by _required_int when a needed field is None). Since the signature verified, this points at a signer that omitted fields — usually a homegrown or outdated signer, not client tampering.
Source
Thrown at studio/backend/utils/native_path_leases.py:319
def _validate_payload(
payload: dict[str, Any], *, operation: str, expected_kind: str | None
) -> None:
required = (
"version",
"operation",
"canonical_path",
"path_kind",
"path_type",
"source_kind",
"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:View on GitHub (pinned to 203007d190)
Solutions
- Update the desktop app (or your signing harness) to the current grant schema so all ten required fields are present.
- If you maintain the signer, diff its payload keys against the required tuple in _validate_payload and emit any missing ones.
- Reject/retire grants from old app versions — have users re-pick files after upgrading both shell and backend together.
Example fix
# before (test signer omitting fields)
payload = {"version": 1, "operation": op, "canonical_path": str(p)}
# after
payload = {
"version": 1, "operation": op, "canonical_path": str(p),
"path_kind": "file", "path_type": "file", "source_kind": "dialog",
"token_id_hash": token_hash, "issued_at_ms": now_ms,
"expires_at_ms": now_ms + 600_000, "nonce": secrets.token_hex(16),
} Defensive patterns
Strategy: validation
Validate before calling
REQUIRED = {"version","operation","canonical_path","path_kind","path_type","source_kind","token_id_hash","issued_at_ms","expires_at_ms","nonce"}
def payload_complete(payload: dict) -> bool:
return REQUIRED <= payload.keys() Try / catch
try:
grant = verify_native_path_lease(lease, operation=OP)
except NativePathLeaseError as exc:
if "missing required fields" in str(exc):
return error_response(400, "File grant is incomplete; update the app and re-select the file.")
raise Prevention
- Upgrade shell and backend together so grant schema stays in sync.
- Pin signer fixtures to the required-field list in _validate_payload.
- Add a contract test that every field the verifier requires is emitted by the signer.
When it happens
Trigger: A custom Rust/Python signing harness that doesn't emit every required field; a grant issued by an older app version whose schema lacked a field (e.g. token_id_hash or nonce added later); optional fields like size_bytes/modified_ms are fine to omit, but the ten required ones are not.
Common situations: Version skew between an outdated desktop shell and a newer backend; test fixtures built before schema additions; hand-written signers copying an example payload from old docs.
Related errors
- Native path grant version is unsupported.
- unsupported activation rotation {kind!r} (this build impleme
- sd-server img_gen submit -> {resp.status_code}: {resp.text[:
- A reference was sent empty.
- Invalid base64 media data: {exc}
AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15).
Data as JSON: /api/errors/756307b6215d45aa.
Report an issue: GitHub.