{"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":"Error","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/8641553a1f07374001902d3ce773285db1292b2d/app/src/command/english.ts#L1-L30","documentation":"requestEnglishCommandTranslations fetches `/appearance/langs/en.json` (with cache: no-store) to load English command translation strings. If the HTTP response status is not ok (4xx/5xx), it throws this error embedding the status code. The message text says 'English commands' but the fetched resource is the English i18n language file used to translate command labels.","triggerScenarios":"initializeEnglishCommandTranslations calls requestEnglishCommandTranslations(version) and the fetch of `/appearance/langs/en.json?v=<version>` returns a non-2xx status — e.g. the kernel serves 404 because the file is missing, or 500 on a server error.","commonSituations":"Deployments where app/appearance/langs/en.json was not packaged or was deleted; the workspace's appearance directory misconfigured; a proxy/static server returning 404 for the query-string URL; kernel not fully booted when the frontend requests the file; after an upgrade where appearance assets are stale.","solutions":["Verify app/appearance/langs/en.json exists in the running instance by opening /appearance/langs/en.json in the browser or curl -I","If 404, restore the missing file (reinstall/repackage the app or restore the appearance directory from the repository)","If 403/500, check kernel logs and file permissions on the appearance directory","Add a fallback so a failed load degrades gracefully (use raw command names) instead of failing initialization"],"exampleFix":"// before\nconst response = await fetcher(`/appearance/langs/en.json?v=${version}`, {cache: \"no-store\"});\nif (!response.ok) {\n    throw new Error(`Unable to load English commands: ${response.status}`);\n}\n// after\nconst response = await fetcher(`/appearance/langs/en.json?v=${version}`, {cache: \"no-store\"});\nif (!response.ok) {\n    console.warn(`English command translations unavailable (HTTP ${response.status}), using fallback`);\n    return {};\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"let translations: Record<string, string> = {};\ntry {\n    translations = await requestEnglishCommandTranslations(version);\n} catch (e) {\n    console.warn(\"English i18n load failed, using keys as-is:\", e);\n}","preventionTips":["Ensure app/appearance/langs/en.json ships in the packaged artifact (CI packaging check)","Smoke-test /appearance/langs/en.json over HTTP after deploying","Treat translation loads as non-fatal so a missing language file cannot break initialization"],"tags":["http","i18n","fetch","frontend"],"backgroundTag":"http-error-response","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}