---
title: "Keep a valid form draft after a save failure"
description: "Verify that a controlled server failure preserves a valid draft, shows an actionable error, and allows a single successful retry."
canonical_url: "https://vostride.com/agent-library/forms-validation/server-error-keeps-draft.md"
md_url: "https://vostride.com/agent-library/forms-validation/server-error-keeps-draft.md"
content_kind: "recipe"
topic: "forms-validation"
---

# Keep a valid form draft after a save failure

Verify that a controlled server failure preserves a valid draft, shows an actionable error, and allows a single successful retry.

## Risk

A transient save error can erase long form input or leave a button permanently busy. This scenario uses a known test-environment failure, not an assumption that a slow response has failed.

## Fixtures

- A fixture service rejects the first save of a unique knowledge note with a controlled non-success response.
- The second save is permitted, and an external fixture log records which attempt committed a record.
- The prepared note includes a title, two-paragraph body, and category so preservation covers multiple control types.

## Steps

1. Open a new note, enter the exact fixture title and body, choose the category, and verify all entered values.
2. Submit once and wait for the controlled failure to resolve; verify a visible save error and an available retry action.
3. Verify the title, complete body, and selected category remain unchanged in the editable form.
4. Use the displayed retry or save action once and verify the note detail opens successfully.
5. Reload the saved note and verify all fields, then check the prepared commit log reports exactly one created note.

## Expected results

- The first failed request commits no note according to the test service evidence.
- Every draft field survives the failure, including line breaks and the selected category.
- The eventual saved record matches the original draft and exists exactly once.

## False-pass traps

- Retyping lost content would conceal the draft-preservation regression.
- A spinner disappearing without an error or saved detail is not an adequate failure outcome.

## Cleanup

- Disable the one-shot failure fixture and delete the saved test note.

## Use with agent-qa

Adapt this test design to your application's acceptance criteria and configured target using the [recipe execution guide](/agent-library/software-factory/turn-a-recipe-into-an-agent-qa-test.md). External fixture setup and non-UI checks require your own supported hooks or test tooling. Validate the authored test, execute it, and inspect the completed evidence; this recipe is not a recorded test result.

## References

- [agent-qa test](/docs/agent-qa/configuration/test.md)
- [agent-qa first test](/docs/agent-qa/guides/first-test.md)
- [agent-qa web testing](/docs/agent-qa/guides/web-testing.md)

- [Forms and validation QA recipes](/agent-library/forms-validation.md)
- [Software factory QA library](/agent-library.md)
