{"record":{"id":"105e7c432dc1c4cf","repo":"paperclipai/paperclip","slug":"invalid-question-response","errorCode":null,"errorMessage":"invalid question response","messagePattern":"invalid question response","errorType":"validation","errorClass":"HarnessRuntimeRequestResolutionError","httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/src/contracts/harness-driver.ts","lineNumber":257,"sourceCode":"        \"canonical submissions cannot also carry provider-specific answers or content\",\n      );\n    }\n    if (questionSet === undefined) {\n      throw new HarnessRuntimeRequestResolutionError(\n        requestKind,\n        \"canonical submission requires the persisted question set\",\n      );\n    }\n    try {\n      return {\n        action,\n        response: parsePaperclipQuestionResponse(\n          questionSet,\n          candidate.response,\n        ),\n      };\n    } catch (error) {\n      throw new HarnessRuntimeRequestResolutionError(\n        requestKind,\n        error instanceof Error ? error.message : \"invalid question response\",\n      );\n    }\n  }\n\n  if (requestKind === \"user_input\") {\n    if (action === \"accept\" || action === \"accept_for_session\") {\n      throw new HarnessRuntimeRequestResolutionError(\n        requestKind,\n        \"user input requires submit, decline, or cancel\",\n      );\n    }\n    if (action !== \"submit\") return { action };\n    if (\"content\" in candidate) {\n      throw new HarnessRuntimeRequestResolutionError(\n        requestKind,\n        \"user input submissions carry answers, not content\",","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/src/contracts/harness-driver.ts#L239-L275","documentation":"When a 'submit' resolution for a user_input/elicitation request includes a canonical `response`, it is validated against the persisted PaperclipQuestionSet via parsePaperclipQuestionResponse. Any validation failure is rethrown as a HarnessRuntimeRequestResolutionError; the literal 'invalid question response' is used when the underlying error has no message.","triggerScenarios":"Submitting `{ action: 'submit', response: ... }` where the response fails question validation: missing required fields, wrong field ids, non-string answers, answers violating single/multi-choice constraints, or the questionSet was not supplied (that case has its own message).","commonSituations":"UI form schema drifted from the persisted question set; response keyed by question text instead of field id; stale question set after the request was regenerated; empty answer arrays for required questions.","solutions":["Validate the response against the current PaperclipQuestionSet before submitting (field ids, answer types, required fields).","Re-fetch the question set for the request and rebuild the response from it.","Include the underlying validation error message to identify the exact field that failed.","Ensure the caller passes the persisted questionSet argument when using canonical `response` submissions."],"exampleFix":"// before\nsubmit({ action: 'submit', response: { 'What next?': ['ok'] } });\n// after\nsubmit({ action: 'submit', response: { q_next_step: ['ok'] } }); // keyed by field id, validated against questionSet","handlingStrategy":"validation","validationCode":"function responseMatchesQuestionSet(response, questionSet) {\n  return questionSet.questions.every((q) =>\n    q.required ? Array.isArray(response[q.id]) && response[q.id].length > 0 : response[q.id] === undefined || Array.isArray(response[q.id]));\n}","typeGuard":null,"tryCatchPattern":"try {\n  await submitResponse(requestId, response);\n} catch (e) {\n  if (e instanceof HarnessRuntimeRequestResolutionError) {\n    const fresh = await fetchQuestionSet(requestId);\n    await submitResponse(requestId, buildResponseFromQuestionSet(fresh));\n  } else throw e;\n}","preventionTips":["Generate responses directly from the persisted question set, never from cached form state.","Key answers by question field id, not display text.","Re-fetch the request (and its question set) if it may have been regenerated."],"tags":["validation","forms","schema"],"backgroundTag":"schema-validation-failed","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}