# Generation failed

AI generation can fail because TestVibe cannot start the workflow, the selected runner cannot reach the target site, a provider key is missing, or the feature instructions do not give the agent enough context.

## First Checks

1. Open the failed generation in TestVibe.
2. Read the visible failure message and any completed sections.
3. Confirm the target site URL is correct.
4. Confirm the selected agent has the required API key.
5. Confirm the repository is connected and the TestVibe GitHub App can write output.
6. Check the runner if the workflow stayed queued or never reached generation.

## Common Causes

| Cause                      | What to check                                                                  |
| -------------------------- | ------------------------------------------------------------------------------ |
| Missing provider key       | Add `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, or the provider key your team uses. |
| Repository access problem  | Check GitHub App installation and repository permissions.                      |
| Runner unavailable         | Check runner labels, online status, and queue time.                            |
| Site unreachable           | Make sure the runner can open the target site URL.                             |
| Login or test data missing | Add secrets and prerequisite steps.                                            |
| Vague feature instructions | Improve the Gherkin scenario with visible actions and expected outcomes.       |

## When Output Is Partial

Sometimes generation fails after producing useful notes, a feature draft, or a partial test file. Review the output before retrying. It may tell you exactly which selector, page, credential, or requirement was unclear.

## Retry Or Edit First

| Situation                          | Best next action                                          |
| ---------------------------------- | --------------------------------------------------------- |
| Temporary network or runner issue  | Retry after the environment is healthy.                   |
| Missing key, secret, or permission | Fix setup, then regenerate.                               |
| Feature is too broad               | Split it into smaller scenarios, then regenerate.         |
| Test intent is unclear             | Edit the Gherkin, then regenerate.                        |
| Generated code is close but wrong  | Edit the test or refine instructions before regenerating. |

## Related Pages

* [Troubleshoot failed generation](/ai-generation/troubleshoot-failed-generation.md)
* [Write good test instructions](/create-tests/write-good-test-instructions.md)
* [Missing secrets](/troubleshooting/missing-secrets.md)
* [Troubleshoot runners](/runners/troubleshooting-runners.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.testvibe.com/troubleshooting/generation-failed.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
