# AGENT_UI_SPEC_NOT_FOUND

<!-- Generated by docs/modules/diagnostics from the package catalogs. Write a guide in docs/diagnostics/<CODE>.md instead of editing this file. -->

`specFromText()` returns `AGENT_UI_SPEC_NOT_FOUND` when the model's answer has no spec patch. It does not throw: the diagnostic is in `result.diagnostics`, with `path: ""`.

## Why it happens

`catalogPrompt()` tells the model to answer with JSON patches, one on each line, such as `{"op":"add","path":"/root","value":"card"}`. `specFromText()` builds the spec from these lines and skips every other line. The answer has no patch when the model:

- answers with text only;
- sends the whole spec as one JSON object, often in a code fence;
- puts more than one patch on a line.

## Fix it

Send `result.diagnostics` back to the model as JSON and ask again for the whole spec. The `fix` of the diagnostic shows the patch format.

When the model answers often without patches, check that the instructions of the Agent hold `catalogPrompt()` for the same surface. Set `mode: 'inline'` when the model must write text before the spec.

## Related

- [`AGENT_UI_PATCH_INVALID`](https://vitehub.dev/docs/agents/diagnostics/agent_ui_patch_invalid)
- [`AGENT_UI_SPEC_INVALID`](https://vitehub.dev/docs/agents/diagnostics/agent_ui_spec_invalid)

## Source

`AGENT_UI_SPEC_NOT_FOUND` belongs to the `agent` package. Its catalog entry is in [`src/ui/diagnostics.ts`](https://github.com/vite-hub/vitehub/blob/main/packages/agent/src/ui/diagnostics.ts#L100).

See [all Agents diagnostics](https://vitehub.dev/docs/agents/diagnostics).

<!-- vitehub-docs:section-links -->
## In this section

- [Start](https://vitehub.dev/raw/docs/agents.md)
- [Define and run](https://vitehub.dev/raw/docs/agents/agent-definitions.md)
- [Instructions and tools](https://vitehub.dev/raw/docs/agents/instructions.md)
- [History and context](https://vitehub.dev/raw/docs/agents/chat-history-sessions.md)
- [Channels](https://vitehub.dev/raw/docs/agents/channels.md)
- [Inspect and evaluate](https://vitehub.dev/raw/docs/agents/observability.md)
- [Advanced](https://vitehub.dev/raw/docs/agents/agent-presets.md)
- [Recipes](https://vitehub.dev/raw/docs/agents/support-agent.md)
- [Presets](https://vitehub.dev/raw/docs/agents/presets.md)
- [Capabilities](https://vitehub.dev/raw/docs/agents/capabilities/access.md)

Next: [AGENT_UI_TOO_DEEP](https://vitehub.dev/raw/docs/agents/diagnostics/agent_ui_too_deep.md)

All pages: [llms.txt](https://vitehub.dev/llms.txt)
