siyuan-note/siyuan · error

Unable to load English commands

Error message

Unable to load English commands: ${response.status}

What it means

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.

Solutions

  1. Verify app/appearance/langs/en.json exists and is served (open the URL directly in a browser)
  2. Reinstall/repair the app or restore the appearance directory from a fresh release
  3. Clear proxy/CDN caches for /appearance/*
  4. Check the file's permissions are readable by the kernel process

Example fix

// before
if (!response.ok) {
    throw new Error(`Unable to load English commands: ${response.status}`);
}
// after: fall back to untranslated commands instead of failing
if (!response.ok) {
    console.warn(`Unable to load English commands: ${response.status}`);
    return {};
}
Defensive patterns

Strategy: fallback

Validate before calling

const res = await fetch(`/appearance/langs/en.json?v=${version}`, {method: "HEAD"});
if (!res.ok) { console.warn("en.json unavailable; commands will remain untranslated"); }

Try / catch

try {
    await requestEnglishCommandTranslations(version);
} catch (e) {
    console.warn(e.message); // proceed with an empty translation map instead of crashing startup
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of siyuan-note/siyuan@9f775e8a12 (2026-09-19). Data as JSON: /api/errors/6493322cb5198d9c. Report an issue: GitHub.

Appendix: source

Thrown at app/src/command/english.ts:12

let englishLanguages: Record<string, string> | undefined;
let englishLanguagesPromise: Promise<Record<string, string> | undefined> | undefined;

export const getEnglishCommandLabel = (key: string) => englishLanguages?.[key];

export const requestEnglishCommandTranslations = async (
    version: string,
    fetcher: typeof fetch = fetch,
) => {
    const response = await fetcher(`/appearance/langs/en.json?v=${version}`, {cache: "no-store"});
    if (!response.ok) {
        throw new Error(`Unable to load English commands: ${response.status}`);
    }
    return response.json() as Promise<Record<string, string>>;
};

export const initializeEnglishCommandTranslations = (
    currentLanguage: string,
    currentLanguages: Record<string, string>,
    version: string,
) => {
    if (currentLanguage === "en") {
        englishLanguages = currentLanguages;
        return Promise.resolve(englishLanguages);
    }
    if (!englishLanguagesPromise) {
        englishLanguagesPromise = requestEnglishCommandTranslations(version)
            .then(languages => {
                englishLanguages = languages;
                return languages;

View on GitHub (pinned to 9f775e8a12)