FuelLabs/fuels-ts · error · FuelError

CONFIGURABLE_NOT_FOUND

CONFIGURABLE_NOT_FOUND

Error message

No configurable constant named '${key}' found in the Predicate

What it means

Thrown by Predicate.setConfigurableConstants when a key in the supplied configurableConstants map does not match any configurable name declared in the predicate's ABI. The lookup abiInterface.configurables[key] is undefined, so the SDK cannot find the bytecode offset at which to patch the encoded value. This is a name-mismatch error, fired per offending key.

Source

Thrown at packages/account/src/predicate/predicate.ts:297

   */
  private static setConfigurableConstants(
    bytes: Uint8Array,
    configurableConstants: { [name: string]: unknown },
    abiInterface: Interface
  ) {
    const mutatedBytes = bytes;

    try {
      if (Object.keys(abiInterface.configurables).length === 0) {
        throw new FuelError(
          ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
          'Predicate has no configurable constants to be set'
        );
      }

      Object.entries(configurableConstants).forEach(([key, value]) => {
        if (!abiInterface?.configurables[key]) {
          throw new FuelError(
            ErrorCode.CONFIGURABLE_NOT_FOUND,
            `No configurable constant named '${key}' found in the Predicate`
          );
        }

        const { offset } = abiInterface.configurables[key];

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

        mutatedBytes.set(encoded, offset);
      });
    } catch (err) {
      throw new FuelError(
        ErrorCode.INVALID_CONFIGURABLE_CONSTANTS,
        `Error setting configurable constants: ${(<Error>err).message}.`
      );
    }

View on GitHub (pinned to b3f37c91ac)

Solutions

  1. Open the ABI JSON and list the actual keys under configurables; pass only those exact names.
  2. Match the Sway-side casing exactly (configurables are not auto-camelCased).
  3. Recompile the predicate and regenerate the ABI/typedefs if you renamed a constant in Sway.
  4. Remove the offending key from configurableConstants or correct its name.

Example fix

// before — Sway declared `configurable AMOUNT: u64 = 0;` but caller passes 'amount'
new Predicate({ bytecode, abi, configurableConstants: { amount: 100 } });

// after — match the ABI's exact key
new Predicate({ bytecode, abi, configurableConstants: { AMOUNT: 100 } });
Defensive patterns

Strategy: validation

Validate before calling

function filterKnownConfigurables(
  config: Record<string, unknown>,
  abi: any
): Record<string, unknown> {
  const known = new Set(Object.keys(abi?.configurables ?? {}));
  const invalid = Object.keys(config).filter(k => !known.has(k));
  if (invalid.length) throw new Error(`Unknown configurables: ${invalid.join(', ')}`);
  return config;
}

Type guard

function isKnownConfigurable(key: string, abi: any): boolean {
  return Object.prototype.hasOwnProperty.call(abi?.configurables ?? {}, key);
}

Try / catch

import { FuelError, ErrorCode } from '@fuel-ts/errors';
try {
  new Predicate({ bytecode, abi, configurableConstants });
} catch (e) {
  if (e instanceof FuelError && e.code === ErrorCode.CONFIGURABLE_NOT_FOUND) {
    // inspect abi.configurables keys and correct the map
  }
  throw e;
}

Prevention

When it happens

Trigger: Passing configurableConstants whose keys differ from the ABI's configurable names (e.g. wrong casing, renamed constant, extra key); using snake_case vs camelCase inconsistently between Sway and TS; passing a constant from a different predicate version.

Common situations: Sway configurable was renamed (e.g. MAX_FEE -> FEE_LIMIT) but caller still uses the old name; TS code uses camelCase while Sway uses UPPER_SNAKE_CASE; ABI is from a different predicate build; typo in the key string.

Related errors


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