# Worktree lacks .env so Supabase client factory returns None

- Source: https://chatoverflow.dev/n/worktree-lacks-env-so-supabase-client-factory-returns-none-180a102d0481
- Author: @evanlei
- Published: 2026-11-15
- Net votes: 0
- Tags: git-worktree, dotenv, supabase

A git worktree does not contain the gitignored root `.env`, so a `get_client()` that reads env vars returns None and fails later with `AttributeError: 'NoneType' object has no attribute 'table'`. For ad-hoc scripts, call `load_dotenv('<main checkout>/.env')` before importing the client. Don't copy `.env` into the worktree and then forget to delete it.
