actualbudget/actual · error · CompileError

Field "${field}" does not exist in table "${tableName}"

Error message

Field "${field}" does not exist in table "${tableName}"

What it means

The AQL compiler looks up every field in the schema description of its table (getFieldDescription, packages/loot-core/src/server/aql/compiler.ts:57). When the table exists in the schema but the requested field name is not a key in that table's schema object, a CompileError is thrown. This means the query referenced a column that the schema model does not define, so no SQL can be generated safely.

Source

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

  return str === 'group';
}

export function quoteAlias(alias) {
  return alias.indexOf('.') === -1 && !isKeyword(alias) ? alias : `"${alias}"`;
}

function typed(value, type, { literal = false } = {}) {
  return { value, type, literal };
}

function getFieldDescription(schema, tableName, field) {
  if (schema[tableName] == null) {
    throw new CompileError(`Table "${tableName}" does not exist in the schema`);
  }

  const fieldDesc = schema[tableName][field];
  if (fieldDesc == null) {
    throw new CompileError(
      `Field "${field}" does not exist in table "${tableName}"`,
    );
  }
  return fieldDesc;
}

function makePath(state, path) {
  const { schema, paths } = state;

  const parts = path.split('.');
  if (parts.length < 2) {
    throw new CompileError('Invalid path: ' + path);
  }

  const initialTable = parts[0];

  const tableName = parts.slice(1).reduce((tableName, field) => {
    const table = schema[tableName];

View on GitHub (pinned to d4334cb6e6)

Solutions

  1. Check the spelling of the field against the table's schema (packages/loot-core/src/server/aql/schema.ts) and fix the field name in the query.
  2. If the field belongs to another table, qualify it with the correct join path, e.g. 'payee.name' instead of 'name'.
  3. If a recent Actual upgrade renamed the field, update the query to the new field name.
  4. If you own the code adding new schema fields, register the field in the schema definition before querying it.

Example fix

// before
q('transactions')
  .select('ammount')
// after
q('transactions')
  .select('amount')
Defensive patterns

Strategy: validation

Validate before calling

import { schema } from './aql/schema';
function assertField(table, field) {
  if (!schema[table] || schema[table][field] == null) {
    throw new Error(`Unknown field "${field}" on table "${table}"`);
  }
}
assertField('transactions', 'amount');

Type guard

function isValidField(table, field) {
  return typeof field === 'string' && schema[table] != null && schema[table][field] != null;
}

Try / catch

try {
  await q('transactions').select('amount').calculate();
} catch (e) {
  if (e.message.includes('does not exist in table')) {
    // fall back to known-good field or surface a friendly message
  } else throw e;
}

Prevention

When it happens

Trigger: Calling q.select('account.name') / q.filter({ typo: 'x' }) or any aqlQuery where a field string references a column not present in schema[tableName], e.g. q('transactions').select('amountt') or q('accounts').select('balence').

Common situations: Typos in field names; using a field from one table on another table (e.g. 'payee.name' on the transactions table without the join path); referencing fields removed or renamed in a newer Actual release; hand-written rule/custom-report expressions using stale field names.

Related errors


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