{"record":{"id":"2923101b9afbcbbb","repo":"ToolJet/ToolJet","slug":"select-one-operation","errorCode":null,"errorMessage":"Select one operation","messagePattern":"Select one operation","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"marketplace/plugins/supabase/lib/index.ts","lineNumber":23,"sourceCode":"  QueryOptions,\n  Column,\n  Filter,\n  Sort,\n  SupabaseClientType,\n  SupabaseQueryError,\n  SupabaseQueryResult,\n  Response,\n} from './types';\nimport { PostgrestFilterBuilder } from '@supabase/postgrest-js';\n\nexport default class Supabase implements QueryService {\n  async run(sourceOptions: SourceOptions, queryOptions: QueryOptions, dataSourceId: string): Promise<QueryResult> {\n    const supabaseClient = await this.getConnection(sourceOptions);\n    const operation: string = queryOptions.operation;\n    let result: SupabaseQueryResult;\n    let error: SupabaseQueryError;\n    try {\n      if (!operation) throw new Error('Select one operation');\n      const { get_table_name, create_table_name, update_table_name, delete_table_name, count_table_name } =\n        queryOptions;\n      const tableNameValues = {\n        get_rows: get_table_name,\n        create_row: create_table_name,\n        update_row: update_table_name,\n        delete_row: delete_table_name,\n        count_rows: count_table_name,\n      };\n      if (!tableNameValues[operation]) throw new Error('Table name is required');\n      let res: Response;\n      switch (operation) {\n        case 'get_rows':\n          res = await this.getRows(queryOptions, supabaseClient);\n          error = res.error;\n          result = res.data;\n          break;\n        case 'create_row':","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/ToolJet/ToolJet/blob/20602a8e101f2e59686c9afde0d1402aac2c8871/marketplace/plugins/supabase/lib/index.ts#L5-L41","documentation":"Thrown by the Supabase plugin's run() method when queryOptions.operation is falsy. The method dispatches on operation to pick one of get_rows/create_row/update_row/delete_row/count_rows, so an empty operation leaves nothing to execute. It is a pre-execution user-input guard, not a Supabase API failure.","triggerScenarios":"A Supabase query is invoked where the operation dropdown was never set, or queryOptions.operation resolved to undefined/empty string (e.g. bound to a control whose value is blank). The guard `if (!operation) throw new Error('Select one operation')` fires before the table-name check and before any Supabase call.","commonSituations":"Newly created query in the editor before the user picks an operation; operation bound to a dropdown/checkbox that has no default; a programmatic/curl call that omits the operation key; a copied query template where the operation field was cleared.","solutions":["In the query editor, choose one of get_rows, create_row, update_row, delete_row, count_rows from the Operation dropdown.","If operation is bound to a control, give that control a non-empty default value or guard it before run.","When calling run() programmatically, always set queryOptions.operation to one of the five supported values before invoking."],"exampleFix":"// before\nconst queryOptions = { get_table_name: 'users' };\nawait svc.run(sourceOptions, queryOptions, id); // throws 'Select one operation'\n\n// after\nconst queryOptions = { operation: 'get_rows', get_table_name: 'users' };\nawait svc.run(sourceOptions, queryOptions, id);","handlingStrategy":"validation","validationCode":"const SUPABASE_OPS = ['get_rows','create_row','update_row','delete_row','count_rows'];\nfunction normalizeOp(qo) {\n  const op = qo && qo.operation;\n  if (!SUPABASE_OPS.includes(op)) throw new Error(`Select one operation: ${SUPABASE_OPS.join(', ')}`);\n  return op;\n}\n// call before svc.run()\nnormalizeOp(queryOptions);","typeGuard":"function isSupabaseOperation(op): op is 'get_rows'|'create_row'|'update_row'|'delete_row'|'count_rows' {\n  return ['get_rows','create_row','update_row','delete_row','count_rows'].includes(op);\n}","tryCatchPattern":"try { await svc.run(src, qo, id); } catch (e) { if (/Select one operation/.test(e.message)) { /* prompt user to pick operation */ } else throw e; }","preventionTips":["Give the operation dropdown a default value so a fresh query never submits empty.","When building queryOptions programmatically, assert operation is in the allowed set before run.","Bind the operation control to a fixed list so users cannot type arbitrary values."],"tags":["supabase","validation","user-input","plugin"],"backgroundTag":null,"analyzedSha":"20602a8e101f2e59686c9afde0d1402aac2c8871","analyzedAt":"2026-08-13T05:58:54.221Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}