{"record":{"id":"3032cc3d9e38858b","repo":"diegosouzapw/OmniRoute","slug":"invalid-machine-id-format-expected-uuid-format","errorCode":null,"errorMessage":"Invalid machine ID format. Expected UUID format.","messagePattern":"Invalid machine ID format\\. Expected UUID format\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/oauth/services/cursor.ts","lineNumber":115,"sourceCode":"   * @param {string} accessToken - Access token from state.vscdb or auth.json\n   * @param {string} [machineId] - Machine ID from state.vscdb (optional for cursor-agent imports)\n   */\n  async validateImportToken(accessToken: string, machineId?: string) {\n    // Basic validation\n    if (!accessToken || typeof accessToken !== \"string\") {\n      throw new Error(\"Access token is required\");\n    }\n\n    // Token format validation (Cursor tokens are typically long strings)\n    if (accessToken.length < 50) {\n      throw new Error(\"Invalid token format. Token appears too short.\");\n    }\n\n    // Machine ID format validation (only if provided — cursor-agent imports don't have one)\n    if (machineId) {\n      const uuidRegex = /^[a-f0-9-]{32,}$/i;\n      if (!uuidRegex.test(machineId.replace(/-/g, \"\"))) {\n        throw new Error(\"Invalid machine ID format. Expected UUID format.\");\n      }\n    }\n\n    // Note: We don't validate against API because Cursor uses complex protobuf.\n    // Token will be validated when used for actual requests.\n\n    return {\n      accessToken,\n      machineId: machineId || null,\n      expiresIn: 86400, // Cursor tokens typically last 24 hours\n      authMethod: machineId ? \"imported\" : \"cursor-agent\",\n    };\n  }\n\n  /**\n   * Extract user info from token if possible\n   * Cursor tokens may contain encoded user info\n   */","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/services/cursor.ts#L97-L133","documentation":"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.","triggerScenarios":"Thrown at src/lib/oauth/services/cursor.ts:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Re-read machineId from the correct state.vscdb key (cursor's machine identifier table)","If importing from cursor-agent where machineId is optional, omit it instead of passing a junk value","Validate the UUID client-side before submitting the import"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}