decolua/9router · error · Error

Invalid machine ID format. Expected UUID format.

Error message

Invalid machine ID format. Expected UUID format.

What it means

CursorService.validateImportToken() (src/lib/oauth/services/cursor.js:113) validates the machine ID against /^[a-f0-9-]{32,}$/i after stripping hyphens — i.e. it must be a UUID-like hex string of at least 32 characters. The value came from state.vscdb's storage.serviceMachineId but doesn't have that shape, so it can't be used to build the x-cursor-checksum header.

Source

Thrown at src/lib/oauth/services/cursor.js:113

  async validateImportToken(accessToken, machineId) {
    // Basic validation
    if (!accessToken || typeof accessToken !== "string") {
      throw new Error("Access token is required");
    }

    if (!machineId || typeof machineId !== "string") {
      throw new Error("Machine ID 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 (should be UUID-like)
    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,
      expiresIn: 86400, // Cursor tokens typically last 24 hours
      authMethod: "imported",
    };
  }

  /**
   * Extract user info from token if possible
   * Cursor tokens may contain encoded user info
   */
  extractUserInfo(accessToken) {

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Re-read the correct key: sqlite3 state.vscdb "SELECT value FROM itemTable WHERE key='storage.serviceMachineId'".
  2. Trim whitespace and strip surrounding quotes before passing the value.
  3. Check the format locally: /^[a-f0-9-]{32,}$/i.test(id.replace(/-/g, '')) must be true.
  4. If your Cursor version stores a non-UUID serviceMachineId, use the telemetry.machineId UUID if present, or report the format so the regex can be relaxed.

Example fix

// before
await cursorService.validateImportToken(token, machineId);
// after
const id = String(machineId || "").trim().replace(/^["']|["']$/g, "");
if (!/^[a-f0-9-]{32,}$/i.test(id.replace(/-/g, ""))) throw new Error(`Machine ID not UUID-like: ${id.slice(0, 8)}…`);
await cursorService.validateImportToken(token, id);
Defensive patterns

Strategy: validation

Validate before calling

const id = String(rawMachineId || "").trim().replace(/^["']|["']$/g, "");
if (!/^[a-f0-9-]{32,}$/i.test(id.replace(/-/g, ""))) {
  throw new Error(`Machine ID is not UUID-like: "${id}" — did you read telemetry.machineId instead of storage.serviceMachineId?`);
}

Type guard

function isUuidLikeMachineId(v) {
  return typeof v === "string" && /^[a-f0-9-]{32,}$/i.test(v.replace(/-/g, ""));
}

Try / catch

try {
  await cursorService.validateImportToken(token, machineId);
} catch (err) {
  if (/Invalid machine ID format/.test(err.message)) {
    console.error("Re-read storage.serviceMachineId (not telemetry.machineId); trim quotes/whitespace.");
  } else throw err;
}

Prevention

When it happens

Trigger: Calling validateImportToken with a machineId that is not hex/UUID-like — e.g. a telemetry machineId, a MAC address with colons, a value wrapped in quotes or whitespace, an uppercase/non-hex identifier, or a numeric telemetry ID from a different Cursor storage key.

Common situations: The user grabbed the wrong machine ID (e.g. 'telemetry.machineId' instead of 'storage.serviceMachineId'); copy/paste included surrounding quotes; some Cursor builds store a differently formatted ID; trailing newline from shell output was not trimmed.

Related errors


AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30). Data as JSON: /api/errors/c25f54bd34670a1e. Report an issue: GitHub.