laurent22/joplin · error · Error

${errorPrefix}: Field "prompts" is not an object

Error message

${errorPrefix}: Field "prompts" is not an object

What it means

Thrown by `WhisperConfig.processPrompts` when the `prompts` field exists in the config but is not an object (e.g. a string, number, or array). Prompts are expected to be a map of locale → string.

Source

Thrown at packages/app-mobile/services/voiceTyping/whisper.ts:26

import { languageCodeOnly, stringByLocale } from '@joplin/lib/locale';
import { Platform } from 'react-native';

const logger = Logger.create('voiceTyping/whisper');

class WhisperConfig {
	public prompts: Map<string, string> = new Map();
	public supportsShortAudioCtx = false;
	public stringReplacements: [string, string][] = [];
	public regexReplacements: [RegExp, string][] = [];

	public constructor(json: unknown) {
		const errorPrefix = 'Whisper config';
		if (typeof json !== 'object') throw new Error('Whisper config is not an object');

		const processPrompts = () => {
			if (!('prompts' in json)) return;
			if (typeof json.prompts !== 'object') {
				throw new Error(`${errorPrefix}: Field "prompts" is not an object`);
			}

			for (const [key, value] of Object.entries(json.prompts)) {
				if (typeof value !== 'string') {
					throw new Error(`${errorPrefix}: Value for key ${key} is ${typeof value}, not string.`);
				}
				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`);

View on GitHub (pinned to 2654b33620)

Solutions

  1. Edit `config.json` so `prompts` is an object: `{ "en": "...", "fr": "..." }`.
  2. Re-download the model to restore the shipped config.
  3. If writing configs programmatically, schema-validate `prompts` is `Record<string,string>` before write.

Example fix

// before
"prompts": "en-us prompt text"

// after
"prompts": { "en-us": "en-us prompt text" }
Defensive patterns

Strategy: validation

Validate before calling

if ('prompts' in config && (typeof config.prompts !== 'object' || config.prompts === null || Array.isArray(config.prompts))) {
  throw new Error('Whisper config: prompts must be an object');
}

Type guard

const isPromptsObject = (v: unknown): v is Record<string, unknown> =>
  !!v && typeof v === 'object' && !Array.isArray(v);

Try / catch

null

Prevention

When it happens

Trigger: Parsed `config.json` contains `"prompts": "..."` or `"prompts": [...]` or any non-object value. Triggered after the top-level object check passes and `processPrompts` runs.

Common situations: Hand-edited config with `prompts` set to a string by mistake; older format that used an array; migration/typo when authoring the model bundle config.

Related errors


AI-assisted analysis of laurent22/joplin@2654b33620 (2026-08-12). Data as JSON: /api/errors/0164907dffcbaf3f. Report an issue: GitHub.