pinpoint-apm/pinpoint · error · Error
Unsupported locale: ${localeKey}
Error message
Unsupported locale: ${localeKey} What it means
getLocale maps a locale key (e.g. 'en','ko','zh') to a locale object. The switch's default branch throws 'Unsupported locale: <localeKey>' when the requested locale has no registered translation, so consumers never get a partially-localized picker.
Source
Thrown at web-frontend/src/main/v3/packages/datetime-picker/src/utils/locale.ts:96
return result + ' 후';
} else {
return result + ' 전';
}
}
return result;
},
};
case 'ja':
return {
...ja,
};
case 'zh':
return {
...zhCN,
};
default:
throw new Error(`Unsupported locale: ${localeKey}`);
}
};
View on GitHub (pinned to 744c3d3075)
Solutions
- Pass only supported locale keys; map/strip the browser locale to a supported one first
- Add a new case to the switch for the needed locale
- Provide a fallback in the caller (catch and use 'en')
- Log the raw localeKey to confirm what actually arrived
Example fix
// before
const locale = getLocale(navigator.language); // 'pt-BR'
// after
const key = navigator.language.slice(0, 2);
const locale = ['en','ko','zh'].includes(key) ? getLocale(key) : getLocale('en'); Defensive patterns
Strategy: fallback
Validate before calling
const SUPPORTED_LOCALES = ['en','ko','zh']; const key = String(localeKey ?? '').slice(0, 2); if (!SUPPORTED_LOCALES.includes(key)) localeKey = 'en';
Try / catch
let locale;
try { locale = getLocale(key); } catch { locale = getLocale('en'); } Prevention
- Normalize navigator.language to its 2-letter base code
- Maintain a single SUPPORTED_LOCALES constant shared with UI dropdowns
- Always provide an English/default fallback path
- Add a CI check that every shipped locale has a getLocale case
When it happens
Trigger: Calling getLocale('fr') (or any key not handled in the switch) or passing an undefined/null localeKey that is not one of the registered cases.
Common situations: Locale detected from navigator.language returning e.g. 'pt-BR' instead of a bare code, a new locale added to the app but not to this package, or a typo like 'zh-cn' vs 'zh'.
Related errors
- Invalid time unit provided.
- unsupported type:
- application is not WAS. application:${application}, serviceT
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/9061ef3a9f0751a5.
Report an issue: GitHub.