{"record":{"id":"59a31a2aa2832101","repo":"actualbudget/actual","slug":"unknown-table-table-available-tables-avai","errorCode":null,"errorMessage":"Unknown table \"${table}\". Available tables: ${AVAILABLE_TABLES}","messagePattern":"Unknown table \"(.+?)\"\\. Available tables: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/query.ts","lineNumber":166,"sourceCode":"    if (cmdOpts.table && cmdOpts.table !== 'transactions') {\n      throw new Error(\n        '--last implies --table transactions. Cannot use with --table ' +\n          cmdOpts.table,\n      );\n    }\n    if (cmdOpts.limit) {\n      throw new Error('--last and --limit are mutually exclusive');\n    }\n  }\n\n  const table =\n    cmdOpts.table ?? (last !== undefined ? 'transactions' : undefined);\n  if (!table) {\n    throw new Error('--table is required (or use --file or --last)');\n  }\n\n  if (!(table in TABLE_SCHEMA)) {\n    throw new Error(\n      `Unknown table \"${table}\". Available tables: ${AVAILABLE_TABLES}`,\n    );\n  }\n\n  if (cmdOpts.where && cmdOpts.filter) {\n    throw new Error('--where and --filter are mutually exclusive');\n  }\n\n  if (cmdOpts.count && cmdOpts.select) {\n    throw new Error('--count and --select are mutually exclusive');\n  }\n\n  let queryObj = api.q(table);\n\n  if (cmdOpts.count) {\n    queryObj = queryObj.calculate({ $count: '*' });\n  } else if (cmdOpts.select) {\n    queryObj = queryObj.select(cmdOpts.select.split(','));","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/actualbudget/actual/blob/d4334cb6e6123f4d3bcea1ad6166608884c7e658/packages/cli/src/commands/query.ts#L148-L184","documentation":"After resolving the table name, `buildQueryFromFlags` validates it against `TABLE_SCHEMA`. A table name that is not a known key throws this error, listing all available tables, because the query layer cannot generate expressions for an unknown table.","triggerScenarios":"Passing a misspelled or pluralization-wrong table, e.g. `--table transaction`, `--table Transaction`, `--table category`, or any name not present in `TABLE_SCHEMA`.","commonSituations":"Typos and case-sensitivity mistakes when hand-typing; assuming REST-ish plural names; copying table names from other budgeting tools.","solutions":["Use one of the tables listed in the error message exactly (e.g. `transactions`, not `transaction`).","Check casing — table keys are matched exactly, not case-insensitively.","Run the command with a deliberately bad table name once to see the full list of `AVAILABLE_TABLES`, or inspect `TABLE_SCHEMA` in packages/cli/src/commands/query.ts."],"exampleFix":"// before\nactual query --table transaction --last 10\n// after\nactual query --table transactions --last 10","handlingStrategy":"validation","validationCode":"const AVAILABLE = ['transactions','accounts','categories','payees'];\nif (!AVAILABLE.includes(table)) {\n  throw new Error(`unknown table \"${table}\"; expected one of ${AVAILABLE.join(', ')}`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await cli(['query', '--table', table, ...rest]);\n} catch (e) {\n  if (e.message.startsWith('Unknown table')) {\n    console.error(e.message); // lists the available tables\n  }\n}","preventionTips":["Copy table names from the error's Available tables list rather than typing from memory.","Mind exact casing and spelling (transactions, not transaction).","Constrain the table value in wrapper scripts to a known enum."],"tags":["cli","validation","query","invalid-enum-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"d4334cb6e6123f4d3bcea1ad6166608884c7e658","analyzedAt":"2026-08-29T01:02:11.213Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}