Jupyter notebooks for your team.

Try free
← Blog

Colab Disconnect: Why Your Runtime Ended, the Real Time Limits, and How to Stop Losing Work (2026)

A Colab runtime ends when it sits idle, reaches its maximum lifetime (at most 12 hours on the free plan, up to 24 hours of running code on Pro+), loses its browser tab on a plan without background execution, or runs out of compute units. What Google's FAQ says, why click scripts don't fix it, and a checkpoint loop we killed mid-run and resumed.

Fastero Dev TeamFastero Dev Team2026-12-01Last updated: 2026-12-02

We read Google's Colab FAQ and sign-up page, the Colab team's replies on GitHub and the docs of Google's Colab command-line tool to pin down what ends a Colab session on each plan. Then we wrote a training loop that checkpoints every epoch, killed it partway through, and ran it again to see it carry on.

The short answer: a Colab runtime ends for one of four reasons: it sits idle after your code finishes, it reaches its maximum lifetime (at most 12 hours on the free plan, up to 24 hours of running code on Pro+), you close the tab on a plan without background execution (anything below Pro+ or Google AI Ultra), or a paid plan runs out of compute units. Google publishes no idle timeout: "Colab does not publish these limits". You can't reliably prevent a disconnect, so make it cheap: checkpoint to Google Drive and resume, run long jobs on Kaggle with Save & Run All, and schedule data jobs somewhere that needs no open browser. Checked 1 December 2026.

Fastero

Jupyter notebooks for your team, with nothing to install.

Start a notebook or bring your .ipynb files. SQL cells query your databases with no password in the code, and a notebook runs now or on a schedule. Colleagues open it with their own login; viewers are free.

Try free →

What ends a Colab session?

Diagram of the longest a Colab runtime runs: at most 12 hours on Free; 12 hours in general on Pay As You Go and Pro, up to 24 by a 2024 staff reply; up to 24 hours of running code on Pro+ and Google AI Ultra, the only plans that keep running with the tab closed. Idling, running out of units, a crash or Disconnect and delete runtime also end it

What ends a Colab runtime on each plan, from Google's FAQ and sign-up page and the Colab team's replies on GitHub.

What ends it Free Pay As You Go, Pro Pro+, Google AI Ultra
Idle after your code finishes Yes, after an unpublished timeout Yes Yes: background execution covers running code only
Maximum lifetime At most 12 hours 12 hours as a rule; see below Up to 24 hours of running code
Closing the tab Execution is interrupted, the VM deleted soon after Longer runs "based on availability", not promised Keeps running
Compute units run out No units to run out Back to free-plan rules; a job can be stopped Same
A crash, often out of memory Runtime deleted Same Same

What Google's Colab FAQ says about runtime limits

Google says up front that it won't give numbers: "idle timeout periods, maximum VM lifetime, GPU types available, and other factors vary over time. Colab does not publish these limits, in part because they can vary over time." What it does say, as of 1 December 2026:

  • Idle: "Runtimes will time out if you are idle."
  • Lifetime: "In the version of Colab that is free of charge notebooks can run for at most 12 hours, depending on availability and your usage patterns." And: "Colab Pro+ supports continuous code execution for up to 24 hours if you have sufficient compute units."
  • Units: "You can expect to experience backend termination if you exhaust your available compute units on a Pro, Pro+, or Pay As You Go plan."

Pro is where Google's pages disagree. The FAQ says "In general, notebooks can run for at most 12 hours", the sign-up page promises that "Colab Pro users will see extended execution times and saving of output to Drive based on availability", and a Colab maintainer wrote on GitHub in 2024 that "Runtimes last up to 24 hours in Colab Pro". Plan on 12 hours.

The 90-minute idle timeout in many guides isn't Google's: it comes from a 2019 Stack Overflow question that begins "Google Colab notebooks have an idle timeout of 90 minutes and absolute timeout of 12 hours." Colab's other limits and messages are in our Colab limits guide.

Google Colab timeout: what counts as idle

Idle means no code running, not that you stepped away. In April 2026 the Colab team checked the logs of a Pro+ subscriber whose runtimes kept ending: they "were all deleted due to our idle runtime deletion policy while there's no active/unacknowledged executions on those runtimes at the time of deletions." The FAQ puts it in one line: "Idle timeouts only apply if code execution terminates." So:

  • A long training loop isn't idle while it runs, though the lifetime limit still applies.
  • The idle clock starts when the last cell finishes, even on Pro+. Save results inside the job, not in a cell you meant to run in the morning.
  • A runtime that dies mid-run probably crashed. In the same thread, another user's runtimes "were all deleted due to becoming unhealthy, which indicates that your notebook executions crashed somehow (likely from out-of-memory or other such application issues)."

Does Colab keep running if I close the tab?

Only on plans sold with background execution. Colab's sign-up page: "Pro+ users with a positive Colab compute unit balance automatically have background execution enabled for their notebooks, causing execution to continue after the browser closes up to a maximum runtime limit of up to 24 hours." Since 22 September 2026, "Google AI Ultra subscribers also unlock uninterrupted background execution". The catch: "Background execution only applies during an execution state: idle times will still result in VM deletion."

Below Pro+, plan on a closed tab or a sleeping laptop ending the run. For the free plan the sign-up page is blunt: "Users without a paid subscription should not rely on execution to continue in the background; execution will be interrupted when user interaction ceases, and the VM will be deleted soon after that." Pro's longer runs come "based on availability". Pro+ costs $49.99 a month in the US for 600 compute units; see our Colab Pro guide.

Colab "Disconnect and delete runtime": what it does

It resets your machine rather than pausing it: "Selecting Runtime > Disconnect and delete runtime to return all managed virtual machines assigned to you to their original state." Files on the VM's disk, installed packages and everything in memory go; files in your mounted Google Drive stay. "Colab limits how often this can be done to prevent undue resource consumption." Use it to fix a broken runtime or give a GPU back. At the end of a job, runtime.unassign() does it from code; its source says it "can help users save resources by disconnecting soon after execution is finished":

from google.colab import runtime
runtime.unassign()

Colab disconnect prevention: why anti-idle click scripts are a bad idea

A Stack Overflow question from 2019, viewed more than 500,000 times, collects JavaScript you paste into the browser console to click Colab's Connect button every minute. Don't:

  1. It can't beat the lifetime limit. A free runtime still ends by 12 hours, often mid-epoch, with nothing saved.
  2. Users report a CAPTCHA. The top answer now opens: "As of March 2021, none of these methods will work as Google added a CAPTCHA button that randomly pops up after some time."
  3. It works against how Colab shares resources. The FAQ says Colab "prioritizes users who are actively programming in a notebook" and restricts "actions that negatively impact others or are associated with bypassing our anti-abuse policies." Its list of disallowed activities doesn't name keep-alive scripts, so we won't call them banned, but Google asks the opposite: "Consider closing your Colab tabs or disconnecting from your runtime when you are done working". A GPU held open by a script is how people reach the usage-limit block.
  4. Pasting code into the console is how accounts get stolen. Chrome blocks such pastes for people who rarely use DevTools because "Self-XSS attacks typically involve the attacker tricking you into copying and pasting malicious code into your browser's DevTools Console." Your Colab tab is signed in to your Google account.
  5. Google's own tool dropped its keep-alive. The Colab CLI's notes for 25 September 2026: "Removed the keep-alive background daemon and related client/CLI ping functions. VM liveness is automatically maintained by the Colab backend based on kernel activity."

The other trick, a cell running while True: pass, keeps the runtime busy doing nothing: it still ends at the lifetime limit, and on a paid plan it spends compute units all the while.

How to keep Colab running: checkpoint to Drive and resume

You can't stop every disconnect, so make one cost minutes, not hours: save the job's state somewhere that outlives the VM and load it at start. A complete PyTorch loop (in Colab, run the three lines in its opening comment first, so checkpoints go to Drive):

# train.py: a training loop that picks up where it stopped.
# In Colab, mount Drive first so checkpoints outlive the runtime:
#   from google.colab import drive
#   drive.mount('/content/drive')
#   %env CKPT_DIR=/content/drive/MyDrive/checkpoints/run1
import os, time
from pathlib import Path
import torch
 
CKPT_DIR = Path(os.environ.get("CKPT_DIR", "checkpoints"))
CKPT = CKPT_DIR / "last.pt"
EPOCHS = 10
device = "cuda" if torch.cuda.is_available() else "cpu"
 
torch.manual_seed(0)
X = torch.randn(4096, 8)
y = X @ torch.arange(1.0, 9.0) + 0.1 * torch.randn(4096)
model = torch.nn.Linear(8, 1).to(device)
opt = torch.optim.Adam(model.parameters(), lr=0.1)
start = 0
 
if CKPT.exists():
    ck = torch.load(CKPT, map_location=device)
    model.load_state_dict(ck["model"])
    opt.load_state_dict(ck["opt"])
    start = ck["epoch"]
    print(f"Resuming after epoch {start}")
 
for epoch in range(start, EPOCHS):
    g = torch.Generator().manual_seed(epoch)  # same shuffle if this epoch reruns
    for idx in torch.randperm(len(X), generator=g).split(256):
        xb, yb = X[idx].to(device), y[idx].to(device)
        loss = torch.nn.functional.mse_loss(model(xb).squeeze(1), yb)
        opt.zero_grad()
        loss.backward()
        opt.step()
    time.sleep(1)  # stands in for a long epoch
    CKPT_DIR.mkdir(parents=True, exist_ok=True)
    tmp = CKPT.with_suffix(".tmp")
    torch.save({"model": model.state_dict(), "opt": opt.state_dict(),
                "epoch": epoch + 1}, tmp)
    os.replace(tmp, CKPT)  # swap in only a complete file
    print(f"epoch {epoch + 1}/{EPOCHS}  loss {loss.item():.4f}  saved", flush=True)
 
print("weights:", [round(w, 3) for w in model.weight.view(-1).tolist()])

We ran it on a Windows laptop with Python 3.14 and PyTorch 2.15 (CPU build). A small driver script killed the process half a second into epoch 5, with no chance to clean up, as a deleted VM would, then ran it again. Its real output (the uninterrupted reference run is left out):

$ python train.py
epoch 1/10  loss 105.6702  saved
epoch 2/10  loss 55.8261  saved
epoch 3/10  loss 25.4310  saved
epoch 4/10  loss 11.0657  saved
[process killed during epoch 5, exit code 1]
$ ls checkpoints
last.pt
$ python train.py
Resuming after epoch 4
epoch 5/10  loss 4.5956  saved
epoch 6/10  loss 1.4507  saved
epoch 7/10  loss 0.4408  saved
epoch 8/10  loss 0.1579  saved
epoch 9/10  loss 0.0446  saved
epoch 10/10  loss 0.0184  saved
weights: [1.006, 1.998, 3.004, 3.997, 4.996, 6.012, 6.99, 7.919]

The second run skipped the four finished epochs. A run we never interrupted ended with the same weights bit for bit (torch.equal on every tensor), because each epoch's shuffle is seeded by its number and the optimizer state is saved with the model. What makes it work:

  • Save everything needed to continue: model, optimizer state, epoch. Saving only the model restarts Adam's statistics.
  • Write to a temporary file, then rename it, so an interrupted save can't replace the last good checkpoint with half a file. Keep both in one folder: the FAQ warns that "If you attempt to move files from one folder to another via Colab and your operation is interrupted, you may lose all of the data in transit."
  • Checkpoint by time if epochs are long: every 10 to 15 minutes caps what a disconnect costs.
  • Flush Drive at the end. drive.flush_and_unmount() will "Unmount Google Drive and flush any outstanding writes to it." Then call runtime.unassign().
  • For a processing job, the checkpoint is the list of finished pieces. Write each chunk's output to its own file and skip chunks whose file exists, but keep folders modest: Drive operations "can time out when the number of files or subfolders in a folder grows too large."

Jupyter notebooks for your team.

Start free →

Run long jobs where a closed tab doesn't matter: Kaggle

Kaggle runs a whole notebook as a batch job. Click Save Version, choose Save & Run All (Commit), and Kaggle will "run a fresh copy of the notebook start to finish", saving the output with that version; its course adds "there's no harm in doing something else while it's running and coming back later." The Kaggle CLI does the same from a terminal with no browser at all, given a folder holding the notebook and its kernel-metadata.json:

kaggle kernels push -p my-notebook --accelerator NvidiaTeslaT4
kaggle kernels status your-username/my-notebook
kaggle kernels output your-username/my-notebook -p out

A run lasts at most 12 hours, "the maximum notebook runtime" in Kaggle's CLI docs, and GPU time comes from a weekly quota of about 30 hours. Write results to /kaggle/working, and split anything longer than 12 hours into runs that resume from a checkpoint. Quotas and the GPU T4 x2 are in our Kaggle GPU guide and Kaggle vs Colab.

Scheduled notebooks were switched off on 27 March 2026

A notebook that refreshes data every morning used to be a scheduled notebook on Pro+. On 27 March 2026 a Colab product manager posted a "Deprecation Notice of Scheduled Notebooks" on Colab's GitHub tracker: "Due to low usage of scheduled notebooks and our need to focus on areas of growing interest, we're turning this feature off starting today, Friday March 27th, 2026." As of 1 December the issue is open with one reply, from a user who ran notebooks twice a day for a data science competition and had moved to Pro+ partly for scheduling: "Would it be worth considering making this feature a paid service?" Google hasn't answered.

So for a data job that needs no GPU, don't babysit a tab: Kaggle can rerun a notebook on a schedule, cron or GitHub Actions can run one on a machine you control, and Colab Enterprise schedules notebooks in Google Cloud. All nine ways are in how to schedule a Jupyter notebook.

Where Fastero fits: data jobs that don't need a GPU

Keep GPU training on Colab or Kaggle. Fastero's notebooks are for the other job that dies with a Colab tab: the report on company data that should run every morning, the cleaning step, the analysis colleagues open later. Fastero is an AI and data platform where people and AI agents work together on a team's data. Its Free plan, with no card and no end date, gives those notebooks:

  • Schedules that run on the server with no browser open: run a cell, Run All, or set a cron schedule. The interactive notebook server stops after about 10 idle minutes; a scheduled run doesn't need you there.
  • Your own .ipynb, uploaded or imported from the project's Git repository, on Python 3.11 with pandas.
  • SQL cells that query a saved connection (Postgres, MySQL, SQL Server, Redshift, Oracle or BigQuery) and land in Python as a pandas DataFrame named after the cell, plus Secrets that reach cells as environment variables in scheduled runs too.
  • Results on a dashboard: a SQL cell's rows or a Python cell's table, pinned to a dashboard that refreshes when the notebook runs on its schedule.
  • 6 hours a day of notebook and Python time on a workspace server with 1 CPU and 2 GB; on Pro, bigger machines up to 8 CPUs and 32 GB, charged by the hour. Pro is $20 per editor a month; see pricing.

The schedule dialog of a notebook in Fastero, with quick presets and a cron expression set to run daily at 7:00 AM

Scheduling a notebook in Fastero: presets or any cron expression. Sample data.

FAQ

Why does Google Colab keep disconnecting?

Usually the runtime sat idle after the code finished, reached its maximum lifetime, lost its tab on a plan without background execution, or crashed from running out of memory. Paid plans also stop when compute units run out, and Google publishes none of the timeouts.

How long can a Google Colab session run?

At most 12 hours on the free plan, "depending on availability and your usage patterns". Pro+ runs code for up to 24 hours while you have compute units. For Pro, the FAQ says notebooks run for at most 12 hours in general, while a Colab maintainer said up to 24 hours in 2024.

What is the idle timeout in Google Colab?

Google doesn't publish it: "Runtimes will time out if you are idle." Idle means no code executing, so a running training loop doesn't count. The 90 minutes quoted in many guides comes from a 2019 Stack Overflow question.

What does "Disconnect and delete runtime" do in Colab?

It ends the session and returns your virtual machines to their original state, so files on the VM's disk, installed packages and variables are gone. Files on Google Drive are kept.

Can a JavaScript snippet stop Colab from disconnecting?

Not reliably. Click scripts can't extend the maximum lifetime, users have reported CAPTCHAs since 2021, and pasting code from the web into your browser console is a common way accounts get taken over. Save checkpoints instead.

How do I resume training after Colab disconnects?

Save the model, optimizer state and epoch number to Google Drive at each checkpoint, and load them when the script starts. Our example was killed during epoch 5 and finished with exactly the same weights as an uninterrupted run.

Can Colab run a notebook on a schedule?

Not since 27 March 2026, when Google switched scheduled notebooks off in consumer Colab. Colab Enterprise, Kaggle and Fastero run notebooks on a schedule.

Sources

Read on 1 December 2026:


Try Fastero free: keep training on Colab, and schedule the data notebooks that don't need a GPU so they run on the server with no tab to keep open. No credit card required.

Start a notebook next to your team's data.

Python 3.11 with pandas, SQLAlchemy and seaborn, SQL cells on your databases, and scheduled runs on the Free plan. No credit card required.

Follow Fastero on LinkedIn for new articles and examples.