{"record":{"id":"5becafc437f2d999","repo":"actualbudget/actual","slug":"field-field-does-not-exist-in-table-tablen","errorCode":null,"errorMessage":"Field \"${field}\" does not exist in table \"${tableName}\"","messagePattern":"Field \"(.+?)\" does not exist in table \"(.+?)\"","errorType":"exception","errorClass":"CompileError","httpStatus":null,"severity":"error","filePath":"packages/loot-core/src/server/aql/compiler.ts","lineNumber":64,"sourceCode":"  return str === 'group';\n}\n\nexport function quoteAlias(alias) {\n  return alias.indexOf('.') === -1 && !isKeyword(alias) ? alias : `\"${alias}\"`;\n}\n\nfunction typed(value, type, { literal = false } = {}) {\n  return { value, type, literal };\n}\n\nfunction getFieldDescription(schema, tableName, field) {\n  if (schema[tableName] == null) {\n    throw new CompileError(`Table \"${tableName}\" does not exist in the schema`);\n  }\n\n  const fieldDesc = schema[tableName][field];\n  if (fieldDesc == null) {\n    throw new CompileError(\n      `Field \"${field}\" does not exist in table \"${tableName}\"`,\n    );\n  }\n  return fieldDesc;\n}\n\nfunction makePath(state, path) {\n  const { schema, paths } = state;\n\n  const parts = path.split('.');\n  if (parts.length < 2) {\n    throw new CompileError('Invalid path: ' + path);\n  }\n\n  const initialTable = parts[0];\n\n  const tableName = parts.slice(1).reduce((tableName, field) => {\n    const table = schema[tableName];","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/loot-core/src/server/aql/compiler.ts#L46-L82","documentation":"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.","triggerScenarios":"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').","commonSituations":"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.","solutions":["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.","If the field belongs to another table, qualify it with the correct join path, e.g. 'payee.name' instead of 'name'.","If a recent Actual upgrade renamed the field, update the query to the new field name.","If you own the code adding new schema fields, register the field in the schema definition before querying it."],"exampleFix":"// before\nq('transactions')\n  .select('ammount')\n// after\nq('transactions')\n  .select('amount')","handlingStrategy":"validation","validationCode":"import { schema } from './aql/schema';\nfunction assertField(table, field) {\n  if (!schema[table] || schema[table][field] == null) {\n    throw new Error(`Unknown field \"${field}\" on table \"${table}\"`);\n  }\n}\nassertField('transactions', 'amount');","typeGuard":"function isValidField(table, field) {\n  return typeof field === 'string' && schema[table] != null && schema[table][field] != null;\n}","tryCatchPattern":"try {\n  await q('transactions').select('amount').calculate();\n} catch (e) {\n  if (e.message.includes('does not exist in table')) {\n    // fall back to known-good field or surface a friendly message\n  } else throw e;\n}","preventionTips":["Consult packages/loot-core/src/server/aql/schema.ts for exact field names","Use typed query helpers or TypeScript so field names are checked","After upgrading Actual, re-run queries in tests to catch renamed fields"],"tags":["aql","query","schema","compile-error"],"backgroundTag":"unknown-schema-field","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}