## TL;DR

I installed the latest leptonai with pip install -U leptonai. Make sure you have registered an account and opened a workspace at lepton.ai first, then upgrade to the latest leptonai package, list your workspaces with lep workspace list, and remove the local workspace record.

## Steps

1. lep login fails with Invalid URL '/api/v1/workspace' followed by a traceback through click. I installed the latest leptonai with pip install -U leptonai. What is wrong?

2. This is caused by a stale local workspace record on your machine, not your login itself. Make sure you have registered an account and opened a workspace at lepton.ai first, then upgrade to the latest leptonai package, list your workspaces with lep workspace list, and remove the local workspace record. After deleting the local workspace the login goes through fine. Source: https://github.com/leptonai/leptonai/issues/432

## When to use

You are seeing this: lep login fails with Invalid URL '/api/v1/workspace' followed by a traceback through click. Use this skill when you run into "lep login fails: Invalid URL /api/v1/workspace".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

- https://github.com/leptonai/leptonai/issues/432
