Yeachan-Heo/oh-my-codex · error · Error

questions[${index}] type=multi-answerable conflicts with mul

Error message

questions[${index}] type=multi-answerable conflicts with multi_select=false

What it means

Thrown by normalizeQuestionItem when a question declares type=multi-answerable but multi_select is explicitly false. The library keeps the type field and the multi_select flag consistent, so contradictory declarations are rejected during input normalization rather than at render time.

Source

Thrown at src/question/types.ts:160

  const question = safeString(input.question).trim();
  const header = safeString(input.header).trim() || (index === 0 ? inheritedHeader : undefined);
  const other_label = safeString(input.other_label).trim() || 'Other';
  const allow_other = input.allow_other !== false;
  const rawMultiSelect = input.multi_select;
  const parsedType = parseQuestionType(input.type);
  const rawOptions = Array.isArray(input.options) ? input.options : [];
  const id = safeString(input.id).trim() || `q-${index + 1}`;

  if (!question) throw new Error(`questions[${index}].question must be a non-empty string`);
  if (!id) throw new Error(`questions[${index}].id must be a non-empty string`);
  if (rawOptions.length === 0 && !allow_other) {
    throw new Error(`questions[${index}].options must be a non-empty array unless allow_other is true`);
  }
  if (parsedType === 'single-answerable' && rawMultiSelect === true) {
    throw new Error(`questions[${index}] type=single-answerable conflicts with multi_select=true`);
  }
  if (parsedType === 'multi-answerable' && rawMultiSelect === false) {
    throw new Error(`questions[${index}] type=multi-answerable conflicts with multi_select=false`);
  }

  const type = getNormalizedQuestionType({
    type: parsedType,
    multi_select: rawMultiSelect === true,
  });
  return {
    id,
    ...(header ? { header } : {}),
    question,
    options: rawOptions.map((option, optionIndex) => normalizeOption(option, optionIndex)),
    allow_other,
    other_label,
    multi_select: type === 'multi-answerable',
    type,
  };
}

View on GitHub (pinned to 3ad79a8a6f)

Solutions

  1. Set multi_select: true on the multi-answerable question (or omit it if the library derives it from type)
  2. Or change type back to 'single-answerable' if only one answer is intended
  3. Audit generated question files with a JSON schema validator before feeding them to the UI

Example fix

// before
{ "questions": [{ "id": "q1", "type": "multi-answerable", "multi_select": false, "options": [...] }] }
// after
{ "questions": [{ "id": "q1", "type": "multi-answerable", "multi_select": true, "options": [...] }] }
Defensive patterns

Strategy: validation

Validate before calling

for (const q of input.questions ?? []) {
  if (q.type === 'multi-answerable' && q.multi_select === false) throw new Error(`q ${q.id}: multi-answerable requires multi_select !== false`);
}

Type guard

const isConsistentQuestion = (q: any) =>
  !(q?.type === 'multi-answerable' && q.multi_select === false) &&
  !(q?.type === 'single-answerable' && q.multi_select === true);

Prevention

When it happens

Trigger: Passing a questions array item (or legacy single-question object) with type: 'multi-answerable' and multi_select: false to normalizeQuestionInput or any API that builds a QuestionRecord.

Common situations: Editing question JSON by hand, migrating from older schemas where multi_select defaulted differently, or copy-pasting a single-answerable template and changing only the type field.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


AI-assisted analysis of Yeachan-Heo/oh-my-codex@3ad79a8a6f (2026-08-27). Data as JSON: /api/errors/d423dc0a268cefe2. Report an issue: GitHub.