# SQLite: no such table: X

**Code:** `no such table` · **Category:** SQL · **Seen on:** SQLite, Python, Node.js

The SQL refers to a table that doesn't exist in the database file you opened.

## Meaning

Usually the wrong database file (relative path, new empty file created silently), migrations not run, a typo/case difference in the name, or a table living in an attached database/schema (`main.t`, `other.t`). Check `.tables` and the file path your app actually uses.

## Common causes

- Wrong or empty database file (created silently)
- Migrations not applied
- Typo in the table name
- Table in an attached database
- Using a temp table after the connection closed

## Quick fix

1. Run `.tables` / `SELECT name FROM sqlite_master`
2. Use an absolute path to the .db file
3. Apply migrations before queries

## Detailed fix by platform

### Shell

1. 

```sql
sqlite3 app.db ".tables"
sqlite3 app.db "SELECT name FROM sqlite_master WHERE type='table';"
```


## How to diagnose

1. **File** — Right path?
2. **Migrations** — Applied?
3. **Name** — Exact?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/sql/sqlite-no-such-table)
