{"record":{"id":"6493322cb5198d9c","repo":"siyuan-note/siyuan","slug":"unable-to-load-english-commands-response-status","errorCode":null,"errorMessage":"Unable to load English commands: ${response.status}","messagePattern":"Unable to load English commands: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/command/english.ts","lineNumber":12,"sourceCode":"let englishLanguages: Record<string, string> | undefined;\nlet englishLanguagesPromise: Promise<Record<string, string> | undefined> | undefined;\n\nexport const getEnglishCommandLabel = (key: string) => englishLanguages?.[key];\n\nexport const requestEnglishCommandTranslations = async (\n    version: string,\n    fetcher: typeof fetch = fetch,\n) => {\n    const response = await fetcher(`/appearance/langs/en.json?v=${version}`, {cache: \"no-store\"});\n    if (!response.ok) {\n        throw new Error(`Unable to load English commands: ${response.status}`);\n    }\n    return response.json() as Promise<Record<string, string>>;\n};\n\nexport const initializeEnglishCommandTranslations = (\n    currentLanguage: string,\n    currentLanguages: Record<string, string>,\n    version: string,\n) => {\n    if (currentLanguage === \"en\") {\n        englishLanguages = currentLanguages;\n        return Promise.resolve(englishLanguages);\n    }\n    if (!englishLanguagesPromise) {\n        englishLanguagesPromise = requestEnglishCommandTranslations(version)\n            .then(languages => {\n                englishLanguages = languages;\n                return languages;","sourceCodeStart":1,"sourceCodeEnd":30,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/app/src/command/english.ts#L1-L30","documentation":"requestEnglishCommandTranslations fetches the English language file `/appearance/langs/en.json` to translate English command names. If the fetch response is not ok, it throws `Unable to load English commands: ${response.status}`, embedding the HTTP status code. This is a startup/localization integrity check for command palette translations.","triggerScenarios":"en.json is missing or inaccessible at the served path (404), the appearance directory is incomplete after a broken upgrade, or the server returns 5xx for static assets.","commonSituations":"Manual upgrades that replaced app files but left appearance/langs incomplete; workspace served from a read-only or partial install; CDN/proxy caching an old 404 for en.json.","solutions":["Verify app/appearance/langs/en.json exists and is served (open the URL directly in a browser)","Reinstall/repair the app or restore the appearance directory from a fresh release","Clear proxy/CDN caches for /appearance/*","Check the file's permissions are readable by the kernel process"],"exampleFix":"// before\nif (!response.ok) {\n    throw new Error(`Unable to load English commands: ${response.status}`);\n}\n// after: fall back to untranslated commands instead of failing\nif (!response.ok) {\n    console.warn(`Unable to load English commands: ${response.status}`);\n    return {};\n}","handlingStrategy":"fallback","validationCode":"const res = await fetch(`/appearance/langs/en.json?v=${version}`, {method: \"HEAD\"});\nif (!res.ok) { console.warn(\"en.json unavailable; commands will remain untranslated\"); }","typeGuard":null,"tryCatchPattern":"try {\n    await requestEnglishCommandTranslations(version);\n} catch (e) {\n    console.warn(e.message); // proceed with an empty translation map instead of crashing startup\n}","preventionTips":["Keep the appearance/langs directory intact during upgrades","Verify en.json is served before releasing builds","Bypass or refresh CDN caches for static language assets"],"tags":["i18n","network","localization"],"backgroundTag":"file-not-found","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}