# What to do when Cursor times out

- Tool: Cursor
- Difficulty: Beginner
- Time required: 10-15 min
- Compatibility: Cursor Free+, any project
- Last updated: March 2026

## TL;DR

Cursor times out during large generation tasks when the request exceeds the model's token limit or the server connection drops. Breaking the task into smaller prompts, using a different model, and leveraging Composer's checkpoint system lets you resume generation without losing progress or starting over from scratch.

## What to do when Cursor times out

Cursor timeouts happen when generation tasks are too large, network connections drop, or the AI model hits processing limits. This tutorial covers prevention strategies, recovery techniques, and model selection tips for large scaffolding tasks.

## Before you start

- Cursor installed with a project open
- A large generation task that has timed out or may time out
- Familiarity with Cursor Chat (Cmd+L) and Composer (Cmd+I)

## Step-by-step guide

### 1. Understand why Cursor times out

Timeouts occur for three main reasons: the output exceeds the model's token limit, the network connection drops during generation, or the server is overloaded. Identifying the cause helps you choose the right fix.

```
// Common timeout triggers:
// 1. Generating too many files at once (5+ files)
// 2. Very large files (500+ lines of output)
// 3. Complex prompts with many @file references
// 4. Using a slow model during peak hours
// 5. Network instability (VPN, mobile hotspot)
//
// Check the Cursor output panel for error messages:
// - 'Request timed out' = server/network issue
// - 'Context window exceeded' = too much input/output
// - 'Generation stopped' = model hit output limit
```

**Expected result:** Understanding of which timeout cause applies to your situation.

### 2. Break large tasks into smaller chunks

Instead of asking Cursor to scaffold an entire microservice at once, break it into sequential steps. Each step generates 1-2 files, making timeouts unlikely.

```
// Instead of one massive prompt:
// 'Generate a complete user microservice with models,
// routes, middleware, tests, and Docker setup'

// Break into sequential prompts:
// Step 1: 'Generate the User model and types at src/models/User.ts'
// Step 2: 'Generate the user repository at src/repositories/userRepo.ts'
// Step 3: 'Generate the user service at src/services/userService.ts'
// Step 4: 'Generate the user routes at src/routes/users.ts'
// Step 5: 'Generate the middleware at src/middleware/auth.ts'
// Step 6: 'Generate tests for the user service'
// Step 7: 'Generate the Dockerfile'
//
// Each step references the files from previous steps with @file.
```

> Pro tip: Reference files from previous steps with @file in each new prompt. This gives Cursor context about what already exists without reprocessing everything.

**Expected result:** Each generation step completes quickly without timeouts.

### 3. Resume after a timeout using partial output

If Cursor timed out mid-generation, check what was partially created. Cursor may have generated some files before the timeout. Use those as context to continue from where it stopped.

```
// After a timeout:
// 1. Check which files were created/modified
// 2. Review the partial output in the Chat panel
// 3. Start a new prompt referencing what exists:

// Cursor Chat prompt (Cmd+L):
// @src/models/User.ts @src/services/userService.ts
// The previous generation timed out after creating the
// model and service. Continue from where it stopped.
// Next: generate the route handlers at src/routes/users.ts
// that use the existing userService.
```

**Expected result:** Generation continues from the stopping point using existing files as context.

### 4. Switch models for large generation tasks

Some models handle large outputs better than others. GPT-4o and Cursor Small are faster for scaffolding. Claude models produce higher quality but may time out on very large outputs.

```
// Model recommendations for large generation:
//
// Fast scaffolding (many files, basic code):
//   - GPT-4o (fast, good for boilerplate)
//   - Cursor Small (fastest, free)
//
// Quality-critical generation:
//   - Claude 3.5 Sonnet (best quality, may timeout on large tasks)
//   - MAX mode (larger output limit, costs more credits)
//
// To switch models:
// Click the model dropdown at the top of the Chat panel
// Select the model before sending your prompt
```

**Expected result:** The appropriate model selected for your generation task size.

### 5. Use Plan Mode for complex scaffolding

For large scaffolding tasks, use Plan Mode (Shift+Tab) to have Cursor create a step-by-step plan before generating any code. You can then execute the plan one step at a time, avoiding timeouts.

```
// Step 1: Plan Mode (Shift+Tab)
// 'Plan a complete user microservice with: models, repository,
// service, routes, middleware, tests, and Docker. List each
// file to create with its purpose and dependencies.'
//
// Step 2: Execute one step at a time
// 'Execute step 1 of the plan: create the User model'
// 'Execute step 2: create the user repository'
// ... and so on
//
// Plans are saved in .cursor/plans/ for reference.
```

**Expected result:** A detailed plan executed step by step without any single step causing a timeout.

## Complete code example

File: `.cursor/rules/large-tasks.mdc`

```markdown
---
description: Rules for large code generation tasks
globs: ""
alwaysApply: false
---

## Large Task Guidelines
When asked to scaffold or generate multiple files:

1. Generate ONE file at a time, not multiple files per response
2. Wait for user confirmation between files
3. Reference previously created files with @file in each step
4. Keep individual file output under 100 lines
5. For files that need more than 100 lines, split into:
   - Types/interfaces file
   - Implementation file
   - Test file

## File Generation Order
Generate files in dependency order (dependencies first):
1. Types and interfaces (src/types/)
2. Models (src/models/)
3. Repositories (src/repositories/)
4. Services (src/services/)
5. Middleware (src/middleware/)
6. Routes/Controllers (src/routes/)
7. Tests (src/**/*.test.ts)
8. Configuration (Dockerfile, docker-compose.yml)

## If Generation Stops
- Check which files were created
- Reference existing files in the next prompt
- Continue from the last completed step
```

## Common mistakes

- **Asking Cursor to generate an entire project in one prompt** — Large prompts exceed the model's output token limit, causing truncation or timeout before all files are generated. Fix: Break the task into sequential prompts, each generating 1-2 files. Reference previous files with @file.
- **Retrying the exact same prompt after a timeout** — If the prompt caused a timeout due to size, the same prompt will timeout again. You need to make it smaller. Fix: Reduce the scope of the prompt. Generate fewer files per request and reference existing files instead of regenerating them.
- **Not checking partial output after a timeout** — Cursor may have created some files before the timeout. Starting over wastes the partial progress. Fix: Check your file system and Git status for any new or modified files. Use them as context for the continuation prompt.

## Best practices

- Break large generation tasks into 1-2 files per prompt
- Use Plan Mode for complex scaffolding to create a step-by-step execution plan
- Reference previously generated files with @file in each subsequent prompt
- Use GPT-4o or Cursor Small for fast scaffolding of many files
- Use MAX mode for quality-critical large generations
- Check for partial output after timeouts before restarting
- Generate files in dependency order (types first, routes last)

## Frequently asked questions

### How long does Cursor take before timing out?

Typically 30-60 seconds for Chat responses and up to 2 minutes for Agent operations. If you see no response after 60 seconds in Chat, the request likely timed out or is being processed slowly.

### Does Cursor save partial output from timed-out requests?

Partially generated files may be saved to disk by Agent mode. Chat responses that timeout are lost. Check your file system and git status to see if any files were partially created.

### Will MAX mode prevent timeouts?

MAX mode increases the output limit and processing capacity, reducing timeouts for large generations. It uses more credits but is worth it for scaffolding tasks.

### Can I increase Cursor's timeout setting?

There is no user-configurable timeout setting. The timeout is determined by the model and server. Breaking tasks into smaller pieces is more reliable than trying to extend timeouts.

### Should I use Background Agents for large tasks?

Yes. Background Agents (Ctrl+E) run in cloud VMs without the timeout constraints of interactive sessions. They are ideal for large scaffolding tasks. Available on Business+ plans.

---

Source: https://www.rapidevelopers.com/cursor-tutorial/how-to-re-run-cursor-ai-generation-if-it-times-out-while-scaffolding-a-new-microservice
© RapidDev — https://www.rapidevelopers.com/cursor-tutorial/how-to-re-run-cursor-ai-generation-if-it-times-out-while-scaffolding-a-new-microservice
