{"record":{"id":"c3916de99ef78931","repo":"coder/code-server","slug":"custom-strings-file-not-found-filepath-nplease","errorCode":null,"errorMessage":"Custom strings file not found: ${filePath}\\nPlease ensure the file exists and is readable.","messagePattern":"Custom strings file not found: (.+?)\\\\nPlease ensure the file exists and is readable\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/node/i18n/index.ts","lineNumber":39,"sourceCode":"  },\n  ur: {\n    translation: ur,\n  },\n}\n\nexport async function loadCustomStrings(filePath: string): Promise<void> {\n  try {\n    // Read custom strings from file path only\n    const fileContent = await fs.readFile(filePath, \"utf8\")\n    const customStringsData = JSON.parse(fileContent)\n\n    // User-provided strings override all languages.\n    Object.keys(defaultResources).forEach((locale) => {\n      i18next.addResourceBundle(locale, \"translation\", customStringsData)\n    })\n  } catch (error) {\n    if (error && typeof error === \"object\" && \"code\" in error && error.code === \"ENOENT\") {\n      throw new Error(`Custom strings file not found: ${filePath}\\nPlease ensure the file exists and is readable.`)\n    } else if (error instanceof SyntaxError) {\n      throw new Error(`Invalid JSON in custom strings file: ${filePath}\\n${error.message}`)\n    } else {\n      throw new Error(\n        `Failed to load custom strings from ${filePath}: ${error instanceof Error ? error.message : String(error)}`,\n      )\n    }\n  }\n}\n\ninit({\n  lng: \"en\",\n  fallbackLng: \"en\", // language to use if translations in user language are not available.\n  returnNull: false,\n  lowerCaseLng: true,\n  debug: process.env.NODE_ENV === \"development\",\n  resources: defaultResources,\n})","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/coder/code-server/blob/51f90a376b42e217b38937410fe2855e0c1db87e/src/node/i18n/index.ts#L21-L57","documentation":"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.","triggerScenarios":"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.","commonSituations":"Mounting a volume in Docker/k8s at the wrong path; relative paths resolved against an unexpected cwd; deploying before the translations artifact is built.","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)"],"exampleFix":"# before\ncode-server --i18n=./strings.json   # relative, file not in cwd\n\n# after\ncode-server --i18n=/etc/code-server/strings.json","handlingStrategy":"validation","validationCode":"import fs from \"fs/promises\"\nasync function customStringsExists(path: string): Promise<boolean> {\n  try { await fs.access(path, fs.constants.R_OK); return true } catch { return false }\n}\nif (args.i18n && !(await customStringsExists(args.i18n))) {\n  throw new Error(`--i18n file not found: ${args.i18n}`)\n}","typeGuard":"function isENOENT(e: unknown): boolean {\n  return typeof e === \"object\" && e !== null && (e as NodeJS.ErrnoException).code === \"ENOENT\"\n}","tryCatchPattern":"try {\n  await loadCustomStrings(args.i18n)\n} catch (e) {\n  if (isENOENTLike(e)) console.error(`Custom strings file not found: ${args.i18n}`)\n  else throw e\n}","preventionTips":["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"],"tags":["i18n","filesystem","configuration","startup"],"backgroundTag":null,"analyzedSha":"51f90a376b42e217b38937410fe2855e0c1db87e","analyzedAt":"2026-08-12T11:27:34.273Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}