diegosouzapw/OmniRoute · error

Invalid token format. Token appears too short.

Error message

Invalid token format. Token appears too short.

What it means

Error "Invalid token format. Token appears too short." thrown in diegosouzapw/OmniRoute.

Source

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

    return "x86_64";
  }

  /**
   * Validate and import token from Cursor IDE or cursor-agent CLI.
   * 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 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",

View on GitHub (pinned to a179ffed5b)

When it happens

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

Common situations: See trigger scenarios.

Understand the failure class


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