FuelLabs/fuels-ts · error · FuelError

MISSING_CONNECTOR

MISSING_CONNECTOR

Error message

No connector selected for calling ${method}. Use hasConnector before executing other methods.

What it means

Thrown by Fuel.callMethod when there is no current connector or hasConnector() returns false. Every connector-routed operation (signing, network, accounts) delegates to the current connector, so without one the call has no target. The error message names the method and directs you to pre-check with hasConnector.

Source

Thrown at packages/account/src/connectors/fuel.ts:186

      return;
    }
    const currentConnector = this._currentConnector;
    this._unsubscribes.map((unSub) => unSub());
    this._unsubscribes = events.map((event) => {
      const handler = (...args: unknown[]) => this.emit(event, ...args);
      currentConnector.on(event as FuelConnectorEventsType, handler);
      return () => currentConnector.off(event, handler);
    });
  }

  /**
   * Call method from the current connector.
   */
  private async callMethod(method: string, ...args: unknown[]) {
    const hasConnector = await this.hasConnector();
    await this.pingConnector();
    if (!this._currentConnector || !hasConnector) {
      throw new FuelError(
        ErrorCode.MISSING_CONNECTOR,
        `No connector selected for calling ${method}. Use hasConnector before executing other methods.`
      );
    }
    if (typeof this._currentConnector[method as keyof FuelConnector] === 'function') {
      return (this._currentConnector[method as keyof FuelConnector] as CallableFunction)(...args);
    }

    return undefined;
  }

  /**
   * Create a method for each method proxy that is available on the Common interface
   * and call the method from the current connector.
   */
  private setupMethods(): void {
    Object.values(FuelConnectorMethods).forEach((method) => {
      this[method] = async (...args: unknown[]) => this.callMethod(method, ...args);

View on GitHub (pinned to b3f37c91ac)

Solutions

  1. Gate connector calls behind hasConnector: if (await fuel.hasConnector()) { ... } else { prompt user to connect }.
  2. After Fuel.init, ensure a connector is selected via hasConnector before invoking any dependent method.
  3. Listen for the connection event and only then trigger connector-dependent logic.

Example fix

// before
const wallet = await fuel.getWallet(address, provider);

// after
if (!(await fuel.hasConnector())) {
  await fuel.connect(); // or prompt the user
}
const wallet = await fuel.getWallet(address, provider);
Defensive patterns

Strategy: validation

Validate before calling

// Guard every connector-dependent call
if (!(await fuel.hasConnector())) {
  await fuel.connect(); // or prompt user
}
const wallet = await fuel.getWallet(address, provider);

Type guard

async function hasReadyConnector(fuel: Fuel): Promise<boolean> {
  return await fuel.hasConnector();
}

Try / catch

try {
  const wallet = await fuel.getWallet(address, provider);
} catch (e) {
  if (e instanceof FuelError && e.code === ErrorCode.MISSING_CONNECTOR) {
    // prompt user to connect a wallet
  } else throw e;
}

Prevention

When it happens

Trigger: Invoking any connector-delegated Fuel method (e.g. getWallet, currentNetwork, sendTransaction via connector) before a connector is connected/selected, after disconnect, or when the saved connector is no longer installed. The check fires after hasConnector() and pingConnector() resolve.

Common situations: User has not connected their wallet yet, disconnected mid-session, the extension was disabled, or the SDK is used in a context where no connector was ever registered.

Related errors


AI-assisted analysis of FuelLabs/fuels-ts@b3f37c91ac (2026-08-12). Data as JSON: /api/errors/3192bc7d2337e684. Report an issue: GitHub.