actualbudget/actual · error

Table "${pathInfo.tableName}" does not exist

Error message

Table "${pathInfo.tableName}" does not exist

What it means

compileFields (table expansion) resolves the query's path via resolvePath and looks up the resulting table in `state.schema`. If the table name is absent from the schema, a plain Error is thrown because fields cannot be enumerated for a nonexistent table.

Source

Thrown at packages/loot-core/src/server/aql/compiler.ts:882

}

function expandStar(state, expr) {
  let path;
  let pathInfo;
  if (expr === '*') {
    pathInfo = {
      tableName: state.implicitTableName,
      tableId: state.implicitTableId,
    };
  } else if (expr.match(/\.\*$/)) {
    const result = popPath(expr);
    path = result.path;
    pathInfo = resolvePath(state, result.path);
  }

  const table = state.schema[pathInfo.tableName];
  if (table == null) {
    throw new Error(`Table "${pathInfo.tableName}" does not exist`);
  }

  return Object.keys(table).map(field => (path ? `${path}.${field}` : field));
}

const compileSelect = saveStack(
  'select',
  (state, exprs, isAggregate, orders) => {
    // Always include the id if it's not an aggregate
    if (!isAggregate && !exprs.includes('id') && !exprs.includes('*')) {
      exprs = exprs.concat(['id']);
    }

    const select = exprs.map(expr => {
      if (typeof expr === 'string') {
        if (expr.indexOf('*') !== -1) {
          const fields = expandStar(state, expr);

View on GitHub (pinned to d4334cb6e6)

Solutions

  1. Correct the table name to one defined in the AQL schema (transactions, accounts, payees, category_mapping, etc.).
  2. Inspect the schema object in the compiler/schema definitions to confirm valid table keys.
  3. Check relationship path spelling when using joined paths (e.g. `payee.name` not `payees.name`).

Example fix

// before
q('transaction').select('*')
// after
q('transactions').select('*')
Defensive patterns

Strategy: validation

Validate before calling

const SCHEMA_TABLES = new Set(['transactions', 'accounts', 'payees', 'category_mapping', 'categories']);
function assertValidTable(name) {
  if (!SCHEMA_TABLES.has(name)) throw new Error(`Unknown AQL table: ${name}`);
}

Type guard

const isValidTable = (name) => typeof name === 'string' && SCHEMA_TABLES.has(name);

Prevention

When it happens

Trigger: Calling `q(tableName).select('*')` (or an implicit-select) with a tableName string that is not registered in the AQL schema, or joining/selecting through a path like `payee.transferacct` where the intermediate table name is wrong.

Common situations: Typo in a table name, using a raw SQL table name instead of the AQL-mapped name, or referencing a relationship key that does not exist in the schema definition.

Related errors


AI-assisted analysis of actualbudget/actual@d4334cb6e6 (2026-08-29). Data as JSON: /api/errors/42956fde48ea0fc0. Report an issue: GitHub.