decolua/9router · error · Error

Machine ID is required

Error message

Machine ID is required

What it means

Second guard in CursorService.validateImportToken() (src/lib/oauth/services/cursor.js:102): the machineId argument is missing, empty, or not a string. The machine ID (storage.serviceMachineId from state.vscdb) is required because Cursor requests are authenticated with a checksum derived from it via generateChecksum().

Source

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

    }
    return "x86_64";
  }

  /**
   * Validate and import token from Cursor IDE
   * Note: We skip API validation because Cursor API uses complex protobuf format.
   * Token will be validated when actually used for requests.
   * @param {string} accessToken - Access token from state.vscdb
   * @param {string} machineId - Machine ID from state.vscdb
   */
  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,

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Read the machine ID with: sqlite3 state.vscdb "SELECT value FROM itemTable WHERE key='storage.serviceMachineId'" and pass it as the second argument.
  2. Confirm Cursor has been launched at least once so the machine-ID row is populated.
  3. Ensure the value is a string (Buffer values need .toString('utf8')).
  4. Check both values with one query: sqlite3 state.vscdb "SELECT key, value FROM itemTable WHERE key IN ('cursorAuth/accessToken','storage.serviceMachineId')".

Example fix

// before
await cursorService.validateImportToken(token, machineIdRow?.value);
// after
const machineId = machineIdRow?.value?.toString?.("utf8") ?? machineIdRow?.value;
if (!machineId) throw new Error("storage.serviceMachineId not found in state.vscdb");
await cursorService.validateImportToken(token, machineId);
Defensive patterns

Strategy: validation

Validate before calling

const mid = machineIdFromVscdb;
if (typeof mid !== "string" || mid.length === 0) {
  throw new Error("storage.serviceMachineId missing — run: sqlite3 state.vscdb \"SELECT value FROM itemTable WHERE key='storage.serviceMachineId'\"");
}

Type guard

function isNonEmptyString(v) {
  return typeof v === "string" && v.length > 0;
}

Try / catch

try {
  await cursorService.validateImportToken(token, machineId);
} catch (err) {
  if (err.message === "Machine ID is required") {
    console.error("Machine ID not supplied. Fetch storage.serviceMachineId from state.vscdb and pass it as the 2nd argument.");
  } else throw err;
}

Prevention

When it happens

Trigger: Calling validateImportToken(accessToken, undefined | null | '' | non-string) — e.g. the sqlite query for key 'storage.serviceMachineId' returned no row, the form import UI submitted a blank machine-ID field, or the value was parsed as a JSON object rather than a string.

Common situations: The user copied only the access token from the sqlite instructions and skipped step 4; a fresh Cursor install has not yet written storage.serviceMachineId; reading the DB from a script that only selected the accessToken key.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


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