{"record":{"id":"c6345fbd4db3d380","repo":"CherryHQ/cherry-studio","slug":"baselocalepath-not-found","errorCode":null,"errorMessage":"${baseLocalePath} not found.","messagePattern":"(.+?) not found\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/auto-translate-i18n.ts","lineNumber":280,"sourceCode":"\n  const baseLocale = process.env.TRANSLATION_BASE_LOCALE ?? 'en-us'\n  const baseFileName = `${baseLocale}.json`\n\n  // Renderer and main each own an independent catalog (locales/ + translate/); translate both.\n  const catalogs = [\n    {\n      localesDir: path.join(__dirname, '../src/renderer/i18n/locales'),\n      translateDir: path.join(__dirname, '../src/renderer/i18n/translate')\n    },\n    {\n      localesDir: path.join(__dirname, '../src/main/i18n/locales'),\n      translateDir: path.join(__dirname, '../src/main/i18n/translate')\n    }\n  ]\n  for (const { localesDir } of catalogs) {\n    const baseLocalePath = path.join(localesDir, baseFileName)\n    if (!fs.existsSync(baseLocalePath)) {\n      throw new Error(`${baseLocalePath} not found.`)\n    }\n  }\n\n  console.log(\n    `🚀 Starting concurrent translation with ${SCRIPT_CONFIG.MAX_CONCURRENT_TRANSLATIONS} max concurrent requests`\n  )\n  console.log(`⏱️  Translation delay: ${SCRIPT_CONFIG.TRANSLATION_DELAY_MS}ms between requests`)\n  console.log('')\n\n  // Process files using ES6+ array methods\n  const getFiles = (dir: string) =>\n    fs\n      .readdirSync(dir)\n      .filter((file) => {\n        const filename = file.replace('.json', '')\n        return file.endsWith('.json') && file !== baseFileName && !SCRIPT_CONFIG.SKIP_LANGUAGES.includes(filename)\n      })\n      .map((filename) => path.join(dir, filename))","sourceCodeStart":262,"sourceCodeEnd":298,"githubUrl":"https://github.com/CherryHQ/cherry-studio/blob/726446b54cd69ffe51a276638672f6d95ca0768c/scripts/auto-translate-i18n.ts#L262-L298","documentation":"Thrown by scripts/auto-translate-i18n.ts when the base locale file (the source language file other locales are translated from) does not exist in one of the configured locales directories (renderer and main i18n locale folders). The script reads the base file to source translation strings, so it must exist before translation can run.","triggerScenarios":"Running the auto-translate script with a --base filename that does not exist (e.g. --base en.json when the file is named en-US.json), running it before the base locale has been created, or running from a worktree/branch where the locale file was removed or renamed.","commonSituations":"Renaming the base locale file (en.json -> en-US.json) without updating the script invocation; running the script in a fresh checkout that lacks generated locale files; pointing --base at a directory path by mistake; case-sensitivity mismatch on a case-sensitive filesystem (Linux CI vs macOS dev).","solutions":["Verify the base locale file exists in both src/renderer/i18n/locales and src/main/i18n/locales: ls src/renderer/i18n/locales/<base> src/main/i18n/locales/<base>.","Pass the correct --base filename matching the actual file (watch case and the en vs en-US convention).","If the base locale was renamed, update the default baseFileName in the script or pass the new name explicitly.","Run the script from the repository root so the __dirname-relative paths resolve correctly."],"exampleFix":"# before\nnpx tsx scripts/auto-translate-i18n.ts --base en-US.json # file is en.json\n\n# after\nnpx tsx scripts/auto-translate-i18n.ts --base en.json","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs'\nimport path from 'node:path'\n\nconst base = 'en.json'\nfor (const dir of [\n  'src/renderer/i18n/locales',\n  'src/main/i18n/locales'\n]) {\n  if (!existsSync(path.join(dir, base))) {\n    throw new Error(`Missing base locale ${base} in ${dir}`)\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Confirm the base locale filename (case-sensitive) matches what the script expects before running.","Run the script from the repository root so relative paths resolve.","After renaming a locale file, update the script's default base filename or pass --base explicitly."],"tags":["i18n","script","build","localization"],"backgroundTag":null,"analyzedSha":"726446b54cd69ffe51a276638672f6d95ca0768c","analyzedAt":"2026-08-12T17:30:37.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}