Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

(bug) A refused template load shows a raw JSON error and replays the same request forever

Aperta
#7,041 1 commento 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #7117 di @lorenzozanee — chiusa senza merge

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python, typescript
Ambito
api, frontend

Direzione di ricerca

Start with web/packages/agenta-entities/src/workflow/state/loadTemplate.ts and the existing cleanup primitive in agenta-entities/src/session/api/api.ts; then trace error extraction through web/packages/agenta-shared/src/utils/extractApiErrorMessage.ts and the two router exception definitions. Check the linked PR #7117 and its discussion before proceeding. Done means terminal conflicts clear the stored intent, the API message reaches the toast, and both routers use the same conflict code, with tests covering those cases.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug report frontend

When creating an agent from a template is refused with a 409, the toast shows the raw error body, and the app keeps the stored request, so pressing Create again sends the same request under the same key and gets the same refusal. The only way out is to close the tab.

What the user sees

The toast reads:

Status code: 409
Body: {
  "detail": {
    "code": "template_load_conflict",
    ...
  }
}

The sentence the API wrote for this case never reaches the screen, and the raw JSON is not something a user can act on.

Steps to reproduce

  1. Start creating an agent from a gallery template.
  2. Make the template load answer 409.
  3. Press Create again, and reload the page and press Create again.

Expected: a readable message saying what went wrong, and a way to start over.

Actual: the raw body above, on every attempt, for as long as the tab is open.

Where it comes from

Read on release/v0.119.1.

The stored intent survives the failure. web/packages/agenta-entities/src/workflow/state/loadTemplate.ts writes {key, request} into sessionStorage before the call, and clears it only on success, or when the user explicitly cancels through abandonAgentTemplateLoad. Every later attempt reads the stored intent back, including after a page reload, so a deterministic refusal is a dead end for that project and template.

The message is lost in the client. The generated client collapses the response into an AgentaApiError whose message is built from the status code and the serialized body (web/packages/agenta-api-client/src/generated/errors/AgentaApiError.ts). extractApiErrorMessage (web/packages/agenta-shared/src/utils/extractApiErrorMessage.ts) finds no detail.message on that error object and falls back to error.message, which is that assembled string. web/packages/agenta-home-ui/src/useCreateAgent.ts toasts the result. The string template_load_conflict appears nowhere in web/.

The two routers that can raise this also disagree on the code. The agent templates router answers template_load_conflict (api/oss/src/apis/fastapi/agent_templates/exceptions.py) and the sessions router answers idempotency_key_reused for the same condition, so a client cannot branch on the code.

Note that PR #7026 changes this file for a different case: an edited prompt now mints a new key instead of replaying the old body. That does not cover a refusal on an unchanged body, which is the case here.

Proposed fix

  1. Clear the stored intent in loadTemplate.ts when the response carries a terminal conflict code, before rethrowing, so the next attempt starts a new creation instead of replaying a dead one. The primitive already exists one endpoint over, in agenta-entities/src/session/api/api.ts.
  2. Render the message the API sent, by reading detail.message off the error body rather than letting the toast fall back to the assembled error string.
  3. Make the two routers answer the same code for the same condition, so a client can branch on it.
Lingua principale
TypeScript
Stelle
4.8k
Fork
690
Merge medio
20h 5m
PR unite (30g)
420

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Agenta-AI/agenta

Tutte le issue di Agenta-AI/agenta

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.