{"record":{"id":"4695bb88d358fc8b","repo":"unslothai/unsloth","slug":"native-path-grant-version-is-unsupported","errorCode":null,"errorMessage":"Native path grant version is unsupported.","messagePattern":"Native path grant version is unsupported\\.","errorType":"validation","errorClass":"NativePathLeaseError","httpStatus":400,"severity":"error","filePath":"studio/backend/utils/native_path_leases.py","lineNumber":321,"sourceCode":"    payload: dict[str, Any], *, operation: str, expected_kind: str | None\n) -> None:\n    required = (\n        \"version\",\n        \"operation\",\n        \"canonical_path\",\n        \"path_kind\",\n        \"path_type\",\n        \"source_kind\",\n        \"token_id_hash\",\n        \"issued_at_ms\",\n        \"expires_at_ms\",\n        \"nonce\",\n    )\n    missing = [key for key in required if key not in payload]\n    if missing:\n        raise NativePathLeaseError(\"Native path grant payload is missing required fields.\")\n    if _required_int(payload, \"version\") != 1:\n        raise NativePathLeaseError(\"Native path grant version is unsupported.\")\n    if payload[\"operation\"] != operation:\n        raise NativePathLeaseError(\"Native path grant operation is invalid.\")\n    if expected_kind and payload[\"path_kind\"] != expected_kind:\n        raise NativePathLeaseError(\"Native path grant kind is invalid.\")\n    now_ms = int(time.time() * 1000)\n    issued_at_ms = _required_int(payload, \"issued_at_ms\")\n    expires_at_ms = _required_int(payload, \"expires_at_ms\")\n    if issued_at_ms >= expires_at_ms:\n        raise NativePathLeaseError(\"Native path grant timestamps are inconsistent.\")\n    if expires_at_ms <= now_ms:\n        raise NativePathLeaseError(\"Native path grant has expired.\")\n    if issued_at_ms > now_ms + 30_000:\n        raise NativePathLeaseError(\"Native path grant issue time is invalid.\")\n    for key in (\"canonical_path\", \"nonce\", \"token_id_hash\", \"display_label\"):\n        raw = payload.get(key)\n        if raw is None:\n            continue\n        if \"\\x00\" in str(raw):","sourceCodeStart":303,"sourceCodeEnd":339,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/utils/native_path_leases.py#L303-L339","documentation":"The payload's version field is present and integer-coercible but is not 1 — the only grant schema version this backend understands. Old or future grant formats are rejected explicitly rather than mis-parsed.","triggerScenarios":"A desktop shell from a different app version signing version=2 (or 0) grants; a custom test signer that defaulted version to 0 or omitted thought and set it to something else; or manual payload editing (which would normally fail HMAC first, so in practice this means a different-version signer).","commonSituations":"App/backend version skew after a partial upgrade (new backend, old shell or vice versa); test harnesses with arbitrary version numbers; schema migration periods where two formats coexist.","solutions":["Upgrade (or pin) the desktop shell and backend to matching versions so the signer emits version 1.","In test signers, set payload['version'] = 1 exactly.","If you are introducing a new schema version, teach _validate_payload to accept it before shipping signers that emit it."],"exampleFix":"# before\npayload = {\"version\": 2, ...}\n\n# after\npayload = {\"version\": 1, ...}","handlingStrategy":"try-catch","validationCode":"payload.get(\"version\") == 1  # after base64url-decoding the payload segment","typeGuard":null,"tryCatchPattern":"try:\n    grant = verify_native_path_lease(lease, operation=OP)\nexcept NativePathLeaseError as exc:\n    if \"version is unsupported\" in str(exc):\n        return error_response(400, \"App update required; please restart from the desktop app.\")\n    raise","preventionTips":["Version-lock the desktop shell and backend.","Set version=1 in all test signers.","When evolving the schema, ship verifier support before signer emission."],"tags":["version","schema","compatibility","signing"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}