{"record":{"id":"0f5b1bab097127da","repo":"ToolJet/ToolJet","slug":"no-query-selected","errorCode":null,"errorMessage":"No query selected","messagePattern":"No query selected","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"frontend/src/AppBuilder/_stores/slices/eventsSlice.js","lineNumber":616,"sourceCode":"              {\n                eventId: event.eventId,\n              },\n              'success'\n            );\n            break;\n          }\n          case 'log-error': {\n            get().eventsSlice.logError('Custom Log', 'Custom-log', '', eventObj, {\n              eventId: event.eventId,\n            });\n            break;\n          }\n          case 'run-query': {\n            try {\n              const { queryId, queryName, component, eventId, callbackFns } = event;\n              const params = event['parameters'];\n              if (!queryId && !queryName) {\n                throw new Error('No query selected');\n              }\n              // Check and replace the module input dummy queries with the linked query id\n              /* Logic starts here */\n              const moduleInputDummyQueries = get()?.getModuleInputDummyQueries?.() || {};\n              let updatedQueryId = queryId,\n                updatedQueryName = queryName,\n                updatedModuleId = moduleId;\n              if (moduleInputDummyQueries[queryId]) {\n                updatedQueryId =\n                  get().resolvedStore.modules[moduleId].exposedValues.input[moduleInputDummyQueries[queryId]]?.id;\n                updatedModuleId = 'canvas'; // Updating the moduleId to canvas as the query is a module input query which will be present on canvas\n              }\n              /* Logic ends here */\n\n              if (!updatedQueryId) {\n                throw new Error('No query selected');\n              }\n              const resolvedParams = {};","sourceCodeStart":598,"sourceCodeEnd":634,"githubUrl":"https://github.com/ToolJet/ToolJet/blob/20602a8e101f2e59686c9afde0d1402aac2c8871/frontend/src/AppBuilder/_stores/slices/eventsSlice.js#L598-L634","documentation":"The catch-all in _fetchTables(). This method queries information_schema.TABLES to populate the table dropdown in the query editor. Any error from buildTestConnection() (connection failure), the SQL query itself, or the result mapping is caught and wrapped. The connection is always closed in finally.","triggerScenarios":"Triggered when buildTestConnection() fails (wrong credentials, unreachable host, SSH tunnel failure), the information_schema query fails (insufficient privileges to read information_schema), or sourceOptions.database is undefined/null causing the WHERE clause to match nothing unexpectedly.","commonSituations":"Most common during datasource setup/testing when credentials are wrong, or when the database user lacks SELECT privilege on information_schema (rare but possible with heavily restricted roles). Also occurs when SSH tunnel configuration is incomplete.","solutions":["Test the connection first (testConnection) to isolate connection issues from metadata-query issues.","Verify the database user has privileges to read information_schema (granted by default in MariaDB).","Check that sourceOptions.database is set to the correct schema name.","For SSH connections, verify the SSH bastion and tunnel configuration."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"function validateFetchTablesInput(sourceOptions) {\n  if (!sourceOptions.host && sourceOptions.ssh_enabled !== 'enabled') {\n    return { valid: false, reason: 'sourceOptions.host is required' };\n  }\n  if (!sourceOptions.database) {\n    return { valid: false, reason: 'sourceOptions.database is required to query information_schema' };\n  }\n  if (!sourceOptions.user || !sourceOptions.password) {\n    return { valid: false, reason: 'sourceOptions.user and password are required' };\n  }\n  return { valid: true };\n}","typeGuard":null,"tryCatchPattern":"try {\n  const tables = await mariadb.invokeMethod('listTables', {}, sourceOptions, { search: '' });\n} catch (e) {\n  if (e instanceof QueryError && /access denied|connection/i.test(e.message)) {\n    // Connection issue — verify credentials and network\n  }\n  throw e;\n}","preventionTips":["Run testConnection() before fetching metadata.","Ensure the database user has SELECT privilege on information_schema.","Verify sourceOptions.database is the correct schema name.","For SSH connections, confirm the tunnel configuration is complete and the bastion is reachable."],"tags":["mariadb","metadata","information-schema","connection"],"backgroundTag":null,"analyzedSha":"20602a8e101f2e59686c9afde0d1402aac2c8871","analyzedAt":"2026-08-13T05:58:54.221Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}