coder/code-server · error · Error
Custom strings file not found: ${filePath}\nPlease ensure th
Error message
Custom strings file not found: ${filePath}\nPlease ensure the file exists and is readable. What it means
loadCustomStrings (i18n/index.ts:39) reads the --i18n custom strings file and re-throws a friendly ENOENT message when fs.readFile reports code === 'ENOENT'. This means the path passed to --i18n does not exist or is not accessible at startup.
Source
Thrown at src/node/i18n/index.ts:39
},
ur: {
translation: ur,
},
}
export async function loadCustomStrings(filePath: string): Promise<void> {
try {
// Read custom strings from file path only
const fileContent = await fs.readFile(filePath, "utf8")
const customStringsData = JSON.parse(fileContent)
// User-provided strings override all languages.
Object.keys(defaultResources).forEach((locale) => {
i18next.addResourceBundle(locale, "translation", customStringsData)
})
} catch (error) {
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
throw new Error(`Custom strings file not found: ${filePath}\nPlease ensure the file exists and is readable.`)
} else if (error instanceof SyntaxError) {
throw new Error(`Invalid JSON in custom strings file: ${filePath}\n${error.message}`)
} else {
throw new Error(
`Failed to load custom strings from ${filePath}: ${error instanceof Error ? error.message : String(error)}`,
)
}
}
}
init({
lng: "en",
fallbackLng: "en", // language to use if translations in user language are not available.
returnNull: false,
lowerCaseLng: true,
debug: process.env.NODE_ENV === "development",
resources: defaultResources,
})View on GitHub (pinned to 51f90a376b)
Solutions
- Verify the file exists at the exact absolute path: `ls -l /path/strings.json`
- Use an absolute path for --i18n to avoid cwd ambiguity
- In containers, confirm the file is copied/mounted and readable by the code-server user (check volume mounts and COPY layers)
Example fix
# before code-server --i18n=./strings.json # relative, file not in cwd # after code-server --i18n=/etc/code-server/strings.json
Defensive patterns
Strategy: validation
Validate before calling
import fs from "fs/promises"
async function customStringsExists(path: string): Promise<boolean> {
try { await fs.access(path, fs.constants.R_OK); return true } catch { return false }
}
if (args.i18n && !(await customStringsExists(args.i18n))) {
throw new Error(`--i18n file not found: ${args.i18n}`)
} Type guard
function isENOENT(e: unknown): boolean {
return typeof e === "object" && e !== null && (e as NodeJS.ErrnoException).code === "ENOENT"
} Try / catch
try {
await loadCustomStrings(args.i18n)
} catch (e) {
if (isENOENTLike(e)) console.error(`Custom strings file not found: ${args.i18n}`)
else throw e
} Prevention
- Always pass an absolute path to --i18n
- In containers, COPY the strings file in the image and reference the in-image path
- Add a startup check that the file is readable by the code-server user
When it happens
Trigger: Starting code-server with `--i18n=/path/strings.json` where /path/strings.json does not exist, is a broken symlink, or is in a directory the code-server user cannot traverse.
Common situations: Mounting a volume in Docker/k8s at the wrong path; relative paths resolved against an unexpected cwd; deploying before the translations artifact is built.
Related errors
- Failed to load custom strings from ${filePath}: ${error inst
- Invalid JSON in custom strings file: ${filePath}\n${error.me
- invalid config: ${config}
- Please pass in a password via the config file or environment
- --password can only be set in the config file or passed in v
AI-assisted analysis of coder/code-server@51f90a376b (2026-08-12).
Data as JSON: /api/errors/c3916de99ef78931.
Report an issue: GitHub.