FuelLabs/fuels-ts · error · FuelError
CONFIG_FILE_NOT_FOUND
CONFIG_FILE_NOT_FOUND
Error message
Config file not found!
What it means
Thrown by loadUserConfig when JoyCon cannot resolve any fuels.config.{ts,js,cjs,mjs} walking up from cwd to the filesystem root. The CLI requires a config to know what to build or deploy, so it aborts when none is found.
Source
Thrown at packages/fuels/src/cli/config/loadConfig.ts:26
import { tryFindBinaries } from '../../cli-utils';
import type { FuelsConfig, UserFuelsConfig } from '../types';
import { SwayType, readForcToml, readSwayType } from './forcUtils';
import { validateConfig } from './validateConfig';
export async function loadUserConfig(
cwd: string
): Promise<{ userConfig: UserFuelsConfig; configPath: string }> {
const configJoycon = new JoyCon();
const configPath = await configJoycon.resolve({
files: ['ts', 'js', 'cjs', 'mjs'].map((e) => `fuels.config.${e}`),
cwd,
stopDir: parse(cwd).root,
});
if (!configPath) {
throw new FuelError(FuelError.CODES.CONFIG_FILE_NOT_FOUND, 'Config file not found!');
}
const esbuildOptions: BuildOptions = {
target: 'ES2021',
platform: 'node',
format: 'esm',
};
const result = await bundleRequire({
filepath: configPath,
esbuildOptions,
cwd,
});
const userConfig: UserFuelsConfig = result.mod.default;
return { configPath, userConfig };
}
View on GitHub (pinned to b3f37c91ac)
Solutions
- Run `fuels init` first to generate fuels.config.ts.
- Make sure you invoke fuels from the directory containing fuels.config.ts (or an ancestor of it that JoyCon can walk to — note JoyCon walks up from cwd).
- Rename/move your config so it matches the expected filename.
Example fix
// before fuels build # no fuels.config.ts in tree // after fuels init fuels build
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'fs';
const fuelsConfigPresent = (cwd: string): boolean =>
['ts', 'js', 'cjs', 'mjs'].some((e) => existsSync(`${cwd}/fuels.config.${e}`)); Prevention
- Run `fuels init` before any other fuels command.
- Invoke fuels from the project root containing fuels.config.ts.
- Add a precheck in CI that the config exists before building.
When it happens
Trigger: Running `fuels build` / `fuels deploy` / other fuels commands from a directory tree that contains no fuels.config.* file.
Common situations: Running fuels before `fuels init`, wrong cwd (e.g. inside a package subfolder rather than the project root), config file named differently.
Related errors
- CONFIG_FILE_ALREADY_EXISTS
- CONFIG_FILE_NOT_FOUND
- WORKSPACE_NOT_DETECTED
- Contract not found!
- TYPE_NOT_SUPPORTED
AI-assisted analysis of FuelLabs/fuels-ts@b3f37c91ac (2026-08-12).
Data as JSON: /api/errors/20e7e8828e95d115.
Report an issue: GitHub.