CherryHQ/cherry-studio · error · Error
${baseLocalePath} not found.
Error message
${baseLocalePath} not found. What it means
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.
Source
Thrown at scripts/auto-translate-i18n.ts:280
const baseLocale = process.env.TRANSLATION_BASE_LOCALE ?? 'en-us'
const baseFileName = `${baseLocale}.json`
// Renderer and main each own an independent catalog (locales/ + translate/); translate both.
const catalogs = [
{
localesDir: path.join(__dirname, '../src/renderer/i18n/locales'),
translateDir: path.join(__dirname, '../src/renderer/i18n/translate')
},
{
localesDir: path.join(__dirname, '../src/main/i18n/locales'),
translateDir: path.join(__dirname, '../src/main/i18n/translate')
}
]
for (const { localesDir } of catalogs) {
const baseLocalePath = path.join(localesDir, baseFileName)
if (!fs.existsSync(baseLocalePath)) {
throw new Error(`${baseLocalePath} not found.`)
}
}
console.log(
`🚀 Starting concurrent translation with ${SCRIPT_CONFIG.MAX_CONCURRENT_TRANSLATIONS} max concurrent requests`
)
console.log(`⏱️ Translation delay: ${SCRIPT_CONFIG.TRANSLATION_DELAY_MS}ms between requests`)
console.log('')
// Process files using ES6+ array methods
const getFiles = (dir: string) =>
fs
.readdirSync(dir)
.filter((file) => {
const filename = file.replace('.json', '')
return file.endsWith('.json') && file !== baseFileName && !SCRIPT_CONFIG.SKIP_LANGUAGES.includes(filename)
})
.map((filename) => path.join(dir, filename))View on GitHub (pinned to 726446b54c)
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.
Example fix
# before npx tsx scripts/auto-translate-i18n.ts --base en-US.json # file is en.json # after npx tsx scripts/auto-translate-i18n.ts --base en.json
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync } from 'node:fs'
import path from 'node:path'
const base = 'en.json'
for (const dir of [
'src/renderer/i18n/locales',
'src/main/i18n/locales'
]) {
if (!existsSync(path.join(dir, base))) {
throw new Error(`Missing base locale ${base} in ${dir}`)
}
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- [theme-contract] ${declaration.name} is defined twice in ${s
- [theme-contract] ${label} is missing root declarations: ${mi
- [theme-contract] ${label} references missing foundation vari
- [theme-contract] ${mode} ${declaration.name} in ${declaratio
- [theme-contract] ${mode} variable cycle: ${[...stack.slice(c
AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12).
Data as JSON: /api/errors/c6345fbd4db3d380.
Report an issue: GitHub.