docusealco/docuseal · error · Error

Failed to submit answers

Error message

Failed to submit answers

What it means

Raised when the answers POST returned result.action === 'PASS' but resp.ok is false - a contradictory response where the business payload says success while the HTTP status says error. Because the PASS check runs first, this branch only fires on that mismatch, which almost always means an intermediary (proxy, WAF, middleware) rewrote the status after the body was produced.

Source

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

          headers: { 'Content-Type': 'application/json' }
        })

        const data = await resp.json()

        if (data.result?.action !== 'PASS') {
          if (data.result?.issues?.length) {
            this.error = `Knowledge Based Authentication Failed - make sure you provide correct details for the Knowledge Based authentication: ${data.result.issues.join(', ')}`
          } else {
            this.error = 'Knowledge Based Authentication Failed - make sure you provide correct answers for the Knowledge Based authentication.'
          }

          throw new Error('Knowledge Based Authentication Failed')
        }

        if (!resp.ok) {
          this.error = 'Failed to submit answers'

          throw new Error('Failed to submit answers')
        }

        return resp
      } finally {
        this.isSubmitting = false
      }
    }
  }
}
</script>

View on GitHub (pinned to 004a22c1c8)

Solutions

  1. Reproduce while watching status vs body in the Network tab to confirm the mismatch.
  2. Inspect every proxy between browser and KBA service (nginx, CDN, WAF) for status rewriting or aggressive timeouts.
  3. Reorder the checks to validate resp.ok first so transport errors are reported as transport errors.
  4. If the mismatch is systemic, fix the middleware that alters statuses.

Example fix

// before
if (data.result?.action !== 'PASS') { /* KBA failed */ }
if (!resp.ok) {
  this.error = 'Failed to submit answers'
  throw new Error('Failed to submit answers')
}

// after
if (!resp.ok) {
  this.error = 'Failed to submit answers'
  throw new Error('Failed to submit answers')
}
if (data.result?.action !== 'PASS') { /* KBA failed */ }
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const resp = await fetch(url, opts)
  if (!resp.ok) throw new Error(`Failed to submit answers (HTTP ${resp.status})`)
  const data = await resp.json()
  if (data.result?.action !== 'PASS') throw new Error('Knowledge Based Authentication Failed')
} finally {
  this.isSubmitting = false
}

Prevention

When it happens

Trigger: A reverse proxy returning 502/504 after the upstream streamed a PASS body; auth or rate-limit middleware injecting 4xx on an otherwise successful response; body and status produced by different layers.

Common situations: Gateway timeouts on slow KBA submissions; session cookies expiring mid-quiz so middleware rejects a finished request; WAF rules on POST bodies.

Related errors


AI-assisted analysis of docusealco/docuseal@004a22c1c8 (2026-08-21). Data as JSON: /api/errors/e37ad7e52b376368. Report an issue: GitHub.