{"record":{"id":"328cfc26b5421239","repo":"diegosouzapw/OmniRoute","slug":"invalid-token-format-token-appears-too-short","errorCode":null,"errorMessage":"Invalid token format. Token appears too short.","messagePattern":"Invalid token format\\. Token appears too short\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/oauth/services/cursor.ts","lineNumber":108,"sourceCode":"    return \"x86_64\";\n  }\n\n  /**\n   * Validate and import token from Cursor IDE or cursor-agent CLI.\n   * Note: We skip API validation because Cursor API uses complex protobuf format.\n   * Token will be validated when actually used for requests.\n   * @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\",","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/oauth/services/cursor.ts#L90-L126","documentation":"Error \"Invalid token format. Token appears too short.\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/oauth/services/cursor.ts:108 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}