FuelLabs/fuels-ts · error · FuelError

INVALID_CONFIGURABLE_CONSTANTS

INVALID_CONFIGURABLE_CONSTANTS

Error message

Predicate has no configurable constants to be set

What it means

Thrown by Predicate.setConfigurableConstants when configurableConstants were supplied to a Predicate whose ABI declares zero configurable constants. The SDK refuses because there is nothing to patch into the bytecode; passing values indicates a mismatch between the caller's expectations and the compiled predicate. The error is distinct from CONFIGURABLE_NOT_FOUND, which fires per-key when a specific name is missing.

Source

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

  /**
   * Sets the configurable constants for the predicate.
   *
   * @param bytes - The bytes of the predicate.
   * @param configurableConstants - Configurable constants to be set.
   * @param abiInterface - The ABI interface of the predicate.
   * @returns The mutated bytes with the configurable constants set.
   */
  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);

View on GitHub (pinned to b3f37c91ac)

Solutions

  1. Check the predicate Sway source: if no configurable constants are declared, remove the configurableConstants argument entirely.
  2. If constants are expected, recompile the predicate and pass the matching ABI so configurables is populated.
  3. Verify you are loading the correct ABI file (the one compiled from the predicate whose bytecode you pass).
  4. Conditionally pass configurableConstants only when Object.keys(abi.configurables).length > 0.

Example fix

// before — predicate has no configurables, but values are passed
new Predicate({ bytecode, abi, configurableConstants: { FEE: 10 } });

// after — omit configurableConstants when the ABI declares none
new Predicate({ bytecode, abi });

// or, if constants are expected, recompile so abi.configurables is non-empty
new Predicate({ bytecode, abiWithConfigurables, configurableConstants: { FEE: 10 } });
Defensive patterns

Strategy: validation

Validate before calling

function shouldPassConfigurables(abi: any, config?: Record<string, unknown>) {
  if (!config || Object.keys(config).length === 0) return undefined;
  if (!abi?.configurables || Object.keys(abi.configurables).length === 0) {
    throw new Error('ABI declares no configurable constants');
  }
  return config;
}

Type guard

function abiHasConfigurables(abi: any): boolean {
  return !!abi?.configurables && Object.keys(abi.configurables).length > 0;
}

Try / catch

import { FuelError, ErrorCode } from '@fuel-ts/errors';
try {
  new Predicate({ bytecode, abi, configurableConstants });
} catch (e) {
  if (e instanceof FuelError && e.code === ErrorCode.INVALID_CONFIGURABLE_CONSTANTS) {
    // drop configurableConstants if the predicate has none
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling new Predicate({ configurableConstants: { ... } }) (or Predicate.setup) with a non-empty configurableConstants map while the predicate's ABI has an empty configurables object; passing config that belongs to a different predicate whose ABI you are not using.

Common situations: Predicate source has no configurable constants declared but the caller still passes a map (often copy-pasted from another predicate); predicate was recompiled with configurables removed but caller code was not updated; ABI file is stale and predates the addition/removal of configurables.

Related errors


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