docusealco/docuseal · error · Error

Invalid KBA response

Error message

Invalid KBA response

What it means

The HTTP call succeeded and no FAIL result was returned, but data.output.questions.questions is absent, so there is no quiz to render. The response shape does not match the component's assumed contract (which also includes data.continuations.questions.template.token and data.meta.reference on the following lines). This indicates provider schema drift, an alternate continuation flow, or an intermediary that altered the body.

Source

Thrown at app/javascript/submission_form/kba_step.vue:524

          if (data.result.detail === 'NO MATCH') {
            throw new Error('Unfortunately, we were unable to start Knowledge Based Authentication with the details provided. Please review and confirm that all your personal details are correct.')
          }

          throw new Error(data.result.detail || 'KBA Start Failed')
        }

        if (data.output && data.output.questions && data.output.questions.questions) {
          this.questions = data.output.questions.questions
          this.token = data.continuations.questions.template.token
          this.reference = data.meta.reference

          this.questions.forEach(q => {
            this.answers[q.id] = null
          })

          this.startCountdown()
        } else {
          throw new Error('Invalid KBA response')
        }
      } catch (e) {
        this.error = e.message
      } finally {
        this.isLoading = false
      }
    },
    async submit () {
      this.clearCountdown()

      this.isSubmitting = true
      this.error = null

      const formattedAnswers = Object.keys(this.answers).reduce((acc, key) => {
        acc[key] = [this.answers[key]]

        return acc
      }, {})

View on GitHub (pinned to 004a22c1c8)

Solutions

  1. Dump the raw JSON of the /api/kba response and diff it against the expected output/continuations structure.
  2. Inspect data.continuations for alternate flows and handle them instead of assuming questions always exist.
  3. Update the parsing (including token/reference extraction) to the current schema.
  4. If a proxy sits in front of the KBA service, verify it passes the provider body through unchanged.

Example fix

// before
if (data.output && data.output.questions && data.output.questions.questions) {
  this.questions = data.output.questions.questions
} else {
  throw new Error('Invalid KBA response')
}

// after
const questions = data.output?.questions?.questions
if (!Array.isArray(questions) || questions.length === 0 || !data.continuations?.questions?.template?.token) {
  throw new Error(`Invalid KBA response: ${JSON.stringify(data.result || {})}`)
}
this.questions = questions
Defensive patterns

Strategy: type-guard

Type guard

function hasKbaQuestions(data) {
  return Array.isArray(data?.output?.questions?.questions) &&
    data?.output?.questions?.questions.length > 0 &&
    typeof data?.continuations?.questions?.template?.token === 'string'
}

Try / catch

try {
  const data = await resp.json()
  if (!hasKbaQuestions(data)) throw new Error('Invalid KBA response')
  // ...
} catch (e) {
  this.error = e.message
  console.warn('Unexpected /api/kba payload', data)
}

Prevention

When it happens

Trigger: Provider schema change renames or moves the questions node; the response carries a different continuation (verification pending on another channel) instead of questions; empty question array; a proxy or test stub returning an incomplete fixture.

Common situations: Upgrading the KBA service without updating the frontend; test mocks that only partially implement the response contract; flows where questions are generated asynchronously.

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 docusealco/docuseal@004a22c1c8 (2026-08-21). Data as JSON: /api/errors/e92c96451161332e. Report an issue: GitHub.