continuedev/continue · error · Error

Table name must be in format schema.table_name, got ${tableN

Error message

Table name must be in format schema.table_name, got ${tableName}

What it means

PostgresContextProvider.getContextItems validates each requested table name: it must contain a dot (schema.table_name). Any query or submenu selection without a schema prefix fails this check before any SQL is built.

Source

Thrown at core/context/providers/PostgresContextProvider.ts:68

    query = "",
    _: ContextProviderExtras = {} as ContextProviderExtras,
  ): Promise<ContextItem[]> {
    const pool = await this.getPool();

    try {
      const contextItems: ContextItem[] = [];

      const tableNames = [];
      if (query === PostgresContextProvider.ALL_TABLES) {
        tableNames.push(...(await this.getTableNames(pool)));
      } else {
        tableNames.push(query);
      }

      for (const tableName of tableNames) {
        // Get the table schema
        if (!tableName.includes(".")) {
          throw new Error(
            `Table name must be in format schema.table_name, got ${tableName}`,
          );
        }
        const schemaQuery = `
SELECT column_name, data_type, character_maximum_length
FROM INFORMATION_SCHEMA.COLUMNS
WHERE table_schema = '${tableName.split(".")[0]}'
  AND table_name = '${tableName.split(".")[1]}'`;
        console.log("schemaQuery", schemaQuery);
        const { rows: tableSchema } = await pool.query(schemaQuery);

        // Get the sample rows
        const sampleRows =
          this.options.sampleRows ??
          PostgresContextProvider.DEFAULT_SAMPLE_ROWS;
        const { rows: sampleRowResults } = await pool.query(`
SELECT *
FROM ${tableName}

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Re-run the query as schema.table_name, e.g. public.users
  2. Use the provider submenu to pick tables (which emit qualified names) instead of typing raw names
  3. Consider migrating to the Postgres MCP server since this provider is deprecated

Example fix

# before
@database users
# after
@database public.users
Defensive patterns

Strategy: validation

Validate before calling

function isQualifiedTable(n: string): boolean {
  return /^[\w"$]+\.[\w"$]+$/.test(n.trim());
}
if (!isQualifiedTable(userInput)) warn('Use schema.table_name');

Type guard

function isQualifiedTableName(n: string): n is `${string}.${string}` {
  return /^[\w"$]+\.[\w"$]+$/.test(n.trim());
}

Prevention

When it happens

Trigger: Passing '@database public.users' works, but '@database users' (no schema) or a raw table name selected without schema qualification throws. Also triggered by names containing dots in the table part but no schema, depending on parsing.

Common situations: User types a bare table name; submenu generated names that lost the schema prefix; non-public schemas where users assume the search_path default applies.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/a0f1a722d3b67c8f. Report an issue: GitHub.