diegosouzapw/OmniRoute · error

Invalid machine ID format. Expected UUID format.

Error message

Invalid machine ID format. Expected UUID format.

What it means

UUID format check in validateImportToken: the optional machineId (from state.vscdb) does not look like a UUID. Cursor requires a valid machine identifier alongside the token; a non-UUID value means the wrong field was read from the DB or the ID is corrupted, which would make requests present as an invalid device.

Solutions

  1. Re-read machineId from the correct state.vscdb key (cursor's machine identifier table)
  2. If importing from cursor-agent where machineId is optional, omit it instead of passing a junk value
  3. Validate the UUID client-side before submitting the import
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/oauth/services/cursor.ts:115 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25). Data as JSON: /api/errors/3032cc3d9e38858b. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/oauth/services/cursor.ts:115

   * @param {string} accessToken - Access token from state.vscdb or auth.json
   * @param {string} [machineId] - Machine ID from state.vscdb (optional for cursor-agent imports)
   */
  async validateImportToken(accessToken: string, machineId?: string) {
    // Basic validation
    if (!accessToken || typeof accessToken !== "string") {
      throw new Error("Access token is required");
    }

    // Token format validation (Cursor tokens are typically long strings)
    if (accessToken.length < 50) {
      throw new Error("Invalid token format. Token appears too short.");
    }

    // Machine ID format validation (only if provided — cursor-agent imports don't have one)
    if (machineId) {
      const uuidRegex = /^[a-f0-9-]{32,}$/i;
      if (!uuidRegex.test(machineId.replace(/-/g, ""))) {
        throw new Error("Invalid machine ID format. Expected UUID format.");
      }
    }

    // Note: We don't validate against API because Cursor uses complex protobuf.
    // Token will be validated when used for actual requests.

    return {
      accessToken,
      machineId: machineId || null,
      expiresIn: 86400, // Cursor tokens typically last 24 hours
      authMethod: machineId ? "imported" : "cursor-agent",
    };
  }

  /**
   * Extract user info from token if possible
   * Cursor tokens may contain encoded user info
   */

View on GitHub (pinned to a179ffed5b)