laurent22/joplin · error · Error
${errorPrefix}: values for ${key} must be arrays
Error message
${errorPrefix}: values for ${key} must be arrays What it means
Thrown inside `getReplacements` when iterating the replacement array and an individual entry is not itself an array. Each entry must be a `[pattern, replacement]` pair (a two-element array).
Source
Thrown at packages/app-mobile/services/voiceTyping/whisper.ts:50
}
this.prompts.set(key, value);
}
};
const processOutputSettings = () => {
if (!('output' in json)) return;
if (typeof json.output !== 'object') {
throw new Error(`${errorPrefix}: Field "output" is not an object`);
}
const getReplacements = (key: string, value: unknown) => {
if (!Array.isArray(value)) {
throw new Error(`${errorPrefix}: ${key} must be an array`);
}
const results: [string, string][] = [];
for (const replacement of value) {
if (!Array.isArray(replacement)) {
throw new Error(`${errorPrefix}: values for ${key} must be arrays`);
}
if (typeof replacement[0] !== 'string' || typeof replacement[1] !== 'string') {
throw new Error(`${errorPrefix}: values for ${key} must be pairs of strings`);
}
results.push([replacement[0], replacement[1]]);
}
return results;
};
if ('stringReplacements' in json.output) {
this.stringReplacements = getReplacements('stringReplacements', json.output.stringReplacements);
}
if ('regexReplacements' in json.output) {
this.regexReplacements = getReplacements('regexReplacements', json.output.regexReplacements).map(([key, value]) => {
return [new RegExp(key, 'g'), value];
});View on GitHub (pinned to 2654b33620)
Solutions
- Make every entry a two-element array.
- Re-download the model bundle.
- Schema-validate with `items: { type: 'array', items: { type: 'string' }, minItems: 2 }`.
Example fix
// before "stringReplacements": ["foo", ["a","b"]] // after "stringReplacements": [["foo","bar"], ["a","b"]]
Defensive patterns
Strategy: validation
Validate before calling
for (const entry of config.output.stringReplacements ?? []) {
if (!Array.isArray(entry)) {
throw new Error('Whisper config: each replacement entry must be an array');
}
} Type guard
const isPairArray = (v: unknown): v is unknown[] => Array.isArray(v) && v.length >= 2;
Try / catch
null
Prevention
- Make each replacement entry a two-element array.
- Schema-validate with items.type = array.
- Re-download the bundle on validation failure.
When it happens
Trigger: Config like `{ "stringReplacements": [ "foo", ["a","b"] ] }` where one of the elements is not an array (e.g. a stray string).
Common situations: Authoring error mixing flat strings with pairs; partial migration of an older format.
Related errors
- Whisper config is not an object
- ${errorPrefix}: Field "prompts" is not an object
- ${errorPrefix}: Value for key ${key} is ${typeof value}, not
- ${errorPrefix}: Field "output" is not an object
- ${errorPrefix}: ${key} must be an array
AI-assisted analysis of laurent22/joplin@2654b33620 (2026-08-12).
Data as JSON: /api/errors/12ce31a8af49c269.
Report an issue: GitHub.