{"record":{"id":"9dac27abad596979","repo":"twentyhq/twenty","slug":"could-not-find-the-application-config-file-expect","errorCode":null,"errorMessage":"Could not find the application config file (expected one of: ${APP_CONFIG_CANDIDATE_PATHS.join(', ')}). Create it with defineApplication({ universalIdentifier: ... }) before generating entities.","messagePattern":"Could not find the application config file \\(expected one of: (.+?)\\)\\. Create it with defineApplication\\((.+?)\\) before generating entities\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/twenty-sdk/src/cli/utilities/application/get-application-universal-identifier-or-throw.ts","lineNumber":20,"sourceCode":"  APP_CONFIG_CANDIDATE_PATHS,\n  findAppConfigPath,\n} from '@/cli/utilities/application/find-app-config-path';\nimport { extractManifestFromFile } from '@/cli/utilities/build/manifest/manifest-extract-config-from-file';\n\ntype ApplicationConfigWithUniversalIdentifier = {\n  universalIdentifier?: string;\n};\n\n// Scaffolding derives deterministic identifiers from the application\n// universal identifier, so nothing can be generated before defineApplication\n// declares one.\nexport const getApplicationUniversalIdentifierOrThrow = async (\n  appPath: string,\n): Promise<string> => {\n  const configPath = await findAppConfigPath(appPath);\n\n  if (configPath === null) {\n    throw new Error(\n      `Could not find the application config file (expected one of: ${APP_CONFIG_CANDIDATE_PATHS.join(', ')}). Create it with defineApplication({ universalIdentifier: ... }) before generating entities.`,\n    );\n  }\n\n  const { config } =\n    await extractManifestFromFile<ApplicationConfigWithUniversalIdentifier>({\n      appPath,\n      filePath: configPath,\n    });\n\n  if (!config?.universalIdentifier) {\n    throw new Error(\n      `defineApplication in ${configPath} must declare a universalIdentifier before generating entities.`,\n    );\n  }\n\n  return config.universalIdentifier;\n};","sourceCodeStart":2,"sourceCodeEnd":38,"githubUrl":"https://github.com/twentyhq/twenty/blob/1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6/packages/twenty-sdk/src/cli/utilities/application/get-application-universal-identifier-or-throw.ts#L2-L38","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Create src/application.config.ts with: import { defineApplication } from 'twenty-sdk'; export default defineApplication({ universalIdentifier: 'com.yourcompany.yourapp' });","Verify the file is at the project root's src/ directory, not in a subdirectory.","Ensure the filename exactly matches one of: application.config.ts, application-config.ts, or applicationConfig.ts.","Confirm you are running the CLI from the correct project root directory."],"exampleFix":"// before — no config file exists\n// Run: npx twenty-sdk generate entity User\n// Error: Could not find the application config file\n\n// after — create src/application.config.ts\nimport { defineApplication } from 'twenty-sdk';\nexport default defineApplication({\n  universalIdentifier: 'com.acme.crm-extension',\n});","handlingStrategy":"validation","validationCode":"import { pathExists } from 'fs-extra';\nimport { join } from 'path';\n\nconst CANDIDATES = [\n  'src/application.config.ts',\n  'src/application-config.ts',\n  'src/applicationConfig.ts',\n];\n\nconst hasAppConfig = async (projectRoot: string): Promise<boolean> => {\n  for (const c of CANDIDATES) {\n    if (await pathExists(join(projectRoot, c))) return true;\n  }\n  return false;\n};\n\nif (!(await hasAppConfig(process.cwd()))) {\n  console.error('Create src/application.config.ts with defineApplication first.');\n  process.exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const id = await getApplicationUniversalIdentifierOrThrow(appPath);\n} catch (error) {\n  if (error instanceof Error && error.message.includes('Could not find the application config file')) {\n    console.error('Run the SDK init command to scaffold the config file.');\n    process.exit(1);\n  }\n  throw error;\n}","preventionTips":["Always scaffold new projects with the SDK init template which creates the config file.","Keep the config file at the exact expected path (src/application.config.ts is preferred).","Run the CLI from the project root, not a subdirectory."],"tags":["sdk-cli","configuration","scaffolding","setup"],"backgroundTag":null,"analyzedSha":"1f5dd2bbd2a8da3419c8cfd52dd545c0024df1a6","analyzedAt":"2026-08-12T15:37:27.593Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}