NousResearch/hermes-agent · error
at least two poll options are required
Error message
at least two poll options are required
What it means
Thrown by buildPollPayload when, after trimming and dropping empty entries, fewer than two poll options remain. WhatsApp requires at least two choices for a meaningful poll; likewise the helper caps options at 12 (a separate error). Empty-string options are filtered out, so ['A', ''] also triggers it.
Source
Thrown at scripts/whatsapp-bridge/bridge_helpers.js:539
case 'video':
return { video: buffer, caption: caption || undefined, mimetype: MIME_MAP[ext] || 'video/mp4' };
case 'document':
return {
document: buffer,
fileName: fileName || path.basename(filePath),
caption: caption || undefined,
mimetype: MIME_MAP[ext] || 'application/octet-stream',
};
default:
return null;
}
}
export function buildPollPayload({ question, options, selectableCount = 1 }) {
const cleanQuestion = String(question || '').trim();
const cleanOptions = (options || []).map(option => String(option || '').trim()).filter(Boolean);
if (!cleanQuestion) throw new Error('question is required');
if (cleanOptions.length < 2) throw new Error('at least two poll options are required');
if (cleanOptions.length > 12) throw new Error('at most 12 poll options are supported');
const count = Math.max(1, Math.min(Number(selectableCount) || 1, cleanOptions.length));
return {
poll: {
name: cleanQuestion,
values: cleanOptions,
selectableCount: count,
messageSecret: randomBytes(32),
},
};
}
export function pollCreationMessageFromPayload(payload) {
const poll = payload?.poll;
if (!poll) return null;
const values = Array.isArray(poll.values) ? poll.values : [];
const options = values.map(value => String(value || '').trim()).filter(Boolean);
if (!poll.name || options.length < 2) return null;View on GitHub (pinned to c896c09c42)
Solutions
- Supply at least two non-empty, distinct options in the payload.
- Pass options as an array of strings, not a single delimited string.
- Filter/validate options client-side (length >= 2 after trim) before invoking the bridge.
Example fix
// before
buildPollPayload({ question: 'OK?', options: ['yes'] })
// after
buildPollPayload({ question: 'OK?', options: ['yes', 'no'] }) Defensive patterns
Strategy: validation
Validate before calling
function hasEnoughOptions(options: unknown): boolean {
return Array.isArray(options) && options.filter((o: unknown) => String(o ?? '').trim()).length >= 2
} Type guard
function isPollOptionsArray(o: unknown): o is string[] {
return Array.isArray(o) && o.filter(x => String(x ?? '').trim()).length >= 2 && o.length <= 12
} Try / catch
try {
buildPollPayload(args)
} catch (e) {
if (e instanceof Error && e.message === 'at least two poll options are required')
reply('A poll needs two or more non-empty options.')
else throw e
} Prevention
- Pass options as an array of 2-12 non-empty strings; split joined strings at the caller.
- Filter blank entries and assert count >= 2 before calling the bridge.
- Cover these guards in tool-schema description text the model reads.
When it happens
Trigger: Sending a poll with 0 or 1 options, or with multiple options where all but one are blank/whitespace and get filtered.
Common situations: LLM-generated poll with a single yes-style option, options array passed as a comma-joined string by mistake, or blank entries from a sloppy form.
Related errors
- question is required
- latitude and longitude must be numbers
- latitude/longitude out of range
- Preview mode — launching is disabled.
- no install root
AI-assisted analysis of NousResearch/hermes-agent@c896c09c42 (2026-08-14).
Data as JSON: /api/errors/4a18bb93c593dce1.
Report an issue: GitHub.