FuelLabs/fuels-ts · error · FuelError

CONFIGURABLE_NOT_FOUND

CONFIGURABLE_NOT_FOUND

Error message

Contract does not have configurables to be set

What it means

Declared in ContractFactory.setConfigurableConstants() (packages/contract/src/contract-factory.ts:397) when Object.keys(this.interface.configurables) has zero entries — the contract's ABI declares no configurable constants at all. IMPORTANT: this throw lives inside a try block (line 393) whose catch (line 421) re-wraps every error as INVALID_CONFIGURABLE_CONSTANTS (error 173). Callers therefore observe code INVALID_CONFIGURABLE_CONSTANTS with the message 'Error setting configurable constants on contract: Contract does not have configurables to be set', not code CONFIGURABLE_NOT_FOUND directly.

Source

Thrown at packages/contract/src/contract-factory.ts:397

      return { contract, transactionResult };
    };

    const waitForTransactionId = () => txIdPromise;

    return { waitForResult, contractId, waitForTransactionId };
  }

  /**
   * Set configurable constants of the contract with the specified values.
   *
   * @param configurableConstants - An object containing configurable names and their values.
   */
  setConfigurableConstants(configurableConstants: { [name: string]: unknown }) {
    try {
      const hasConfigurable = Object.keys(this.interface.configurables).length;

      if (!hasConfigurable) {
        throw new FuelError(
          ErrorCode.CONFIGURABLE_NOT_FOUND,
          'Contract does not have configurables to be set'
        );
      }

      Object.entries(configurableConstants).forEach(([key, value]) => {
        if (!this.interface.configurables[key]) {
          throw new FuelError(
            ErrorCode.CONFIGURABLE_NOT_FOUND,
            `Contract does not have a configurable named: '${key}'`
          );
        }

        const { offset } = this.interface.configurables[key];

        const encoded = this.interface.encodeConfigurable(key, value as InputValue);

        const bytes = arrayify(this.bytecode);

View on GitHub (pinned to b3f37c91ac)

Solutions

  1. Remove the configurableConstants option from your deploy call if the contract has no configurables.
  2. Recompile the Sway contract with the desired configurable constants declared and redeploy.
  3. Verify the ABI matches the compiled bytecode — check Interface.configurables keys before calling setConfigurableConstants.

Example fix

// before
const factory = new ContractFactory(bytecode, abi, wallet);
await factory.deploy({ configurableConstants: { FEE: 100 } });

// after
const factory = new ContractFactory(bytecode, abi, wallet);
const hasConfigurables = Object.keys(factory.interface.configurables).length > 0;
if (!hasConfigurables) {
  throw new Error('This contract has no configurables in its ABI');
}
await factory.deploy({ configurableConstants: { FEE: 100 } });
Defensive patterns

Strategy: validation

Validate before calling

const hasConfigurables = Object.keys(factory.interface.configurables).length > 0;
if (!hasConfigurables) {
  throw new Error('This contract ABI has no configurable constants.');
}
// Note: setConfigurableConstants wraps this as INVALID_CONFIGURABLE_CONSTANTS
factory.setConfigurableConstants({ MY_CONFIG: value });

Type guard

function hasConfigurablesInAbi(factory: ContractFactory): boolean {
  return Object.keys(factory.interface.configurables).length > 0;
}

Try / catch

try {
  factory.setConfigurableConstants(configurables);
} catch (e) {
  // Note: code will be INVALID_CONFIGURABLE_CONSTANTS, not CONFIGURABLE_NOT_FOUND
  if (e instanceof FuelError && e.code === 'invalid-configurable-constants') {
    if (e.message.includes('does not have configurables')) {
      // contract has zero configurables in ABI
    }
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling factory.setConfigurableConstants({...}) or passing configurableConstants in deployOptions when the contract's compiled ABI has zero configurable constants. The error is caught and re-thrown as INVALID_CONFIGURABLE_CONSTANTS (error 173) before reaching the caller.

Common situations: Contract compiled without any CONFIGURABLE constants in Sway; attempting to set configurables on a contract that was recompiled with configurables removed; ABI/bytecode mismatch (ABI from a different contract version); calling setConfigurableConstants speculatively.

Related errors


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