ToolJet/ToolJet · error · Error

No query selected

Error message

No query selected

What it means

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.

Source

Thrown at frontend/src/AppBuilder/_stores/slices/eventsSlice.js:616

              {
                eventId: event.eventId,
              },
              'success'
            );
            break;
          }
          case 'log-error': {
            get().eventsSlice.logError('Custom Log', 'Custom-log', '', eventObj, {
              eventId: event.eventId,
            });
            break;
          }
          case 'run-query': {
            try {
              const { queryId, queryName, component, eventId, callbackFns } = event;
              const params = event['parameters'];
              if (!queryId && !queryName) {
                throw new Error('No query selected');
              }
              // Check and replace the module input dummy queries with the linked query id
              /* Logic starts here */
              const moduleInputDummyQueries = get()?.getModuleInputDummyQueries?.() || {};
              let updatedQueryId = queryId,
                updatedQueryName = queryName,
                updatedModuleId = moduleId;
              if (moduleInputDummyQueries[queryId]) {
                updatedQueryId =
                  get().resolvedStore.modules[moduleId].exposedValues.input[moduleInputDummyQueries[queryId]]?.id;
                updatedModuleId = 'canvas'; // Updating the moduleId to canvas as the query is a module input query which will be present on canvas
              }
              /* Logic ends here */

              if (!updatedQueryId) {
                throw new Error('No query selected');
              }
              const resolvedParams = {};

View on GitHub (pinned to 20602a8e10)

Solutions

  1. Test the connection first (testConnection) to isolate connection issues from metadata-query issues.
  2. Verify the database user has privileges to read information_schema (granted by default in MariaDB).
  3. Check that sourceOptions.database is set to the correct schema name.
  4. For SSH connections, verify the SSH bastion and tunnel configuration.
Defensive patterns

Strategy: try-catch

Validate before calling

function validateFetchTablesInput(sourceOptions) {
  if (!sourceOptions.host && sourceOptions.ssh_enabled !== 'enabled') {
    return { valid: false, reason: 'sourceOptions.host is required' };
  }
  if (!sourceOptions.database) {
    return { valid: false, reason: 'sourceOptions.database is required to query information_schema' };
  }
  if (!sourceOptions.user || !sourceOptions.password) {
    return { valid: false, reason: 'sourceOptions.user and password are required' };
  }
  return { valid: true };
}

Try / catch

try {
  const tables = await mariadb.invokeMethod('listTables', {}, sourceOptions, { search: '' });
} catch (e) {
  if (e instanceof QueryError && /access denied|connection/i.test(e.message)) {
    // Connection issue — verify credentials and network
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of ToolJet/ToolJet@20602a8e10 (2026-08-13). Data as JSON: /api/errors/0f5b1bab097127da. Report an issue: GitHub.