twentyhq/twenty · critical · Error

Could not find the application config file (expected one of:

Error message

Could not find the application config file (expected one of: ${APP_CONFIG_CANDIDATE_PATHS.join(', ')}). Create it with defineApplication({ universalIdentifier: ... }) before generating entities.

What it means

Thrown by the Twenty SDK CLI when it cannot locate an application config file at any of the candidate paths (src/application.config.ts, src/application-config.ts, src/applicationConfig.ts). The SDK scaffolding derives deterministic identifiers from the application universal identifier, so code generation (entities, migrations) cannot proceed until defineApplication declares one in a recognized config file.

Source

Thrown at packages/twenty-sdk/src/cli/utilities/application/get-application-universal-identifier-or-throw.ts:20

  APP_CONFIG_CANDIDATE_PATHS,
  findAppConfigPath,
} from '@/cli/utilities/application/find-app-config-path';
import { extractManifestFromFile } from '@/cli/utilities/build/manifest/manifest-extract-config-from-file';

type ApplicationConfigWithUniversalIdentifier = {
  universalIdentifier?: string;
};

// Scaffolding derives deterministic identifiers from the application
// universal identifier, so nothing can be generated before defineApplication
// declares one.
export const getApplicationUniversalIdentifierOrThrow = async (
  appPath: string,
): Promise<string> => {
  const configPath = await findAppConfigPath(appPath);

  if (configPath === null) {
    throw new Error(
      `Could not find the application config file (expected one of: ${APP_CONFIG_CANDIDATE_PATHS.join(', ')}). Create it with defineApplication({ universalIdentifier: ... }) before generating entities.`,
    );
  }

  const { config } =
    await extractManifestFromFile<ApplicationConfigWithUniversalIdentifier>({
      appPath,
      filePath: configPath,
    });

  if (!config?.universalIdentifier) {
    throw new Error(
      `defineApplication in ${configPath} must declare a universalIdentifier before generating entities.`,
    );
  }

  return config.universalIdentifier;
};

View on GitHub (pinned to 1f5dd2bbd2)

Solutions

  1. Create src/application.config.ts with: import { defineApplication } from 'twenty-sdk'; export default defineApplication({ universalIdentifier: 'com.yourcompany.yourapp' });
  2. Verify the file is at the project root's src/ directory, not in a subdirectory.
  3. Ensure the filename exactly matches one of: application.config.ts, application-config.ts, or applicationConfig.ts.
  4. Confirm you are running the CLI from the correct project root directory.

Example fix

// before — no config file exists
// Run: npx twenty-sdk generate entity User
// Error: Could not find the application config file

// after — create src/application.config.ts
import { defineApplication } from 'twenty-sdk';
export default defineApplication({
  universalIdentifier: 'com.acme.crm-extension',
});
Defensive patterns

Strategy: validation

Validate before calling

import { pathExists } from 'fs-extra';
import { join } from 'path';

const CANDIDATES = [
  'src/application.config.ts',
  'src/application-config.ts',
  'src/applicationConfig.ts',
];

const hasAppConfig = async (projectRoot: string): Promise<boolean> => {
  for (const c of CANDIDATES) {
    if (await pathExists(join(projectRoot, c))) return true;
  }
  return false;
};

if (!(await hasAppConfig(process.cwd()))) {
  console.error('Create src/application.config.ts with defineApplication first.');
  process.exit(1);
}

Try / catch

try {
  const id = await getApplicationUniversalIdentifierOrThrow(appPath);
} catch (error) {
  if (error instanceof Error && error.message.includes('Could not find the application config file')) {
    console.error('Run the SDK init command to scaffold the config file.');
    process.exit(1);
  }
  throw error;
}

Prevention

When it happens

Trigger: Running a Twenty SDK CLI command (e.g. generate entity, generate migration) from a project directory that does not contain any of the three recognized application config filenames under src/. This can happen if the file was misnamed, placed in a different directory, or the project was not bootstrapped via the SDK init template.

Common situations: New project scaffolded manually without the SDK init script. File named app.config.ts instead of application.config.ts (missing 'lication'). Running the CLI from the wrong working directory (e.g. packages/ instead of project root). Config file accidentally deleted or never committed.

Related errors


AI-assisted analysis of twentyhq/twenty@1f5dd2bbd2 (2026-08-12). Data as JSON: /api/errors/9dac27abad596979. Report an issue: GitHub.