{"record":{"id":"42956fde48ea0fc0","repo":"actualbudget/actual","slug":"table-pathinfo-tablename-does-not-exist","errorCode":null,"errorMessage":"Table \"${pathInfo.tableName}\" does not exist","messagePattern":"Table \"(.+?)\" does not exist","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/loot-core/src/server/aql/compiler.ts","lineNumber":882,"sourceCode":"}\n\nfunction expandStar(state, expr) {\n  let path;\n  let pathInfo;\n  if (expr === '*') {\n    pathInfo = {\n      tableName: state.implicitTableName,\n      tableId: state.implicitTableId,\n    };\n  } else if (expr.match(/\\.\\*$/)) {\n    const result = popPath(expr);\n    path = result.path;\n    pathInfo = resolvePath(state, result.path);\n  }\n\n  const table = state.schema[pathInfo.tableName];\n  if (table == null) {\n    throw new Error(`Table \"${pathInfo.tableName}\" does not exist`);\n  }\n\n  return Object.keys(table).map(field => (path ? `${path}.${field}` : field));\n}\n\nconst compileSelect = saveStack(\n  'select',\n  (state, exprs, isAggregate, orders) => {\n    // Always include the id if it's not an aggregate\n    if (!isAggregate && !exprs.includes('id') && !exprs.includes('*')) {\n      exprs = exprs.concat(['id']);\n    }\n\n    const select = exprs.map(expr => {\n      if (typeof expr === 'string') {\n        if (expr.indexOf('*') !== -1) {\n          const fields = expandStar(state, expr);\n","sourceCodeStart":864,"sourceCodeEnd":900,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/loot-core/src/server/aql/compiler.ts#L864-L900","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Correct the table name to one defined in the AQL schema (transactions, accounts, payees, category_mapping, etc.).","Inspect the schema object in the compiler/schema definitions to confirm valid table keys.","Check relationship path spelling when using joined paths (e.g. `payee.name` not `payees.name`)."],"exampleFix":"// before\nq('transaction').select('*')\n// after\nq('transactions').select('*')","handlingStrategy":"validation","validationCode":"const SCHEMA_TABLES = new Set(['transactions', 'accounts', 'payees', 'category_mapping', 'categories']);\nfunction assertValidTable(name) {\n  if (!SCHEMA_TABLES.has(name)) throw new Error(`Unknown AQL table: ${name}`);\n}","typeGuard":"const isValidTable = (name) => typeof name === 'string' && SCHEMA_TABLES.has(name);","tryCatchPattern":null,"preventionTips":["Use the exported table name constants rather than raw strings.","Verify relationship paths against the schema definitions before querying.","Remember AQL uses pluralized names like 'transactions', not raw SQL table names."],"tags":["aql","schema","table-not-found"],"backgroundTag":"table-not-found","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}