[AAP-82489] fix: show detailed error message on template launch failure #3617
All Vouch review confidence checks passed
Residual risk 0.18 = Change Risk (0.45) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 448 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.365
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #3617"
general
weight: 0.35
keithjgrant
Summary
When launching a Job/Workflow Job Template through the "Prompt on Launch"
wizard, a rejected launch (e.g. swapping a prompted credential for one of a
different type) showed only the generic HTTP reason phrase — "Bad Request" —
in the failure toast. The wizard's submit handler caught the
RequestErroritself and displayed
err.messageonly, discarding the API's parsed JSONbody (e.g.
{"credentials": ["Cannot assign a Credential of kind \token\", ...]})that contains the actual validation detail.
This fixes the toast to route the error through the existing
useAwxErrorMessageParser()/awxErrorAdapter, so the specific APIvalidation message is shown instead of the generic status text.
Root cause
Per AAP-82489, changing a credential to one of a different type at launch is
intentional backend behavior (documented since 2018 in
docs/prompting.md— a same-type replacement is required so a relaunch usesthe up-to-date credential). Engineering confirmed this in the Jira comments,
and the customer's original complaint about the block itself was later
withdrawn. The remaining, still-valid complaint was that the UI didn't
surface why the launch failed — just "Bad Request" — even though the API
already returns a specific, actionable message.
frontend/awx/resources/templates/TemplatePage/TemplateLaunchWizard.tsx'shandleSubmitwraps the launchpostRequestin its owntry/catchandshows a toast built from
err.messagealone. Since it catches locally, theerror never reaches
PageWizardProvider's ownsubmitErrorstate and itsRequestErrorAlert, and it also never runs the (JSON-aware) error adapter.Type of Change
Risk Analysis - REQUIRED
Testing
Manual Testing
1. Create a Job Template with "Prompt on launch" enabled for Credentials, with a default credential set.
2. Launch the template and, on the Credentials prompt, swap the credential for one of a different credential type.
3. Submit the wizard.
4. Before this fix: the failure toast shows only "Bad Request". After this fix: the toast shows the specific validation message returned by the API (e.g.
Cannot assign a Credential of kind \token\.).Regression test
Added a test to
TemplateLaunchWizard.test.tsx: mocks the launch POST returning a 400with a
credentialsvalidation array (the exact body from the Jira report)and asserts the toast's
childrenis the specific message, not the genericstatus text.
Mutation testing: the workflow's automated mutation-test script errored
on reverse-applying the fix patch (unrelated tooling issue), so I verified
manually — checked out the pre-fix version of the source file and confirmed
the new test fails, then restored the fix and confirmed it (and the other 19
tests in the file) pass.
Similar bug detection: the same pattern (
error instanceof Error &&swallowing aerror.message
RequestError's JSON body in a toast) appearsin ~29 other call sites across awx/eda/hub, e.g.
frontend/awx/resources/templates/hooks/useLaunchTemplate.tsx:52andfrontend/awx/resources/templates/TemplatePage/RelaunchTemplateWithPasswords.tsx:65.Out of scope for this fix — noting for future cleanup.
<img width="1383" height="632" alt="Screenshot 2026-09-21 at 10 18 10 AM" src="https://github.com/user-attachments/assets/4a84ee2b-74fe-44dd-999f-8143a14f7aa0" />
Assisted-by: Claude Code / Sonnet 5 (Anthropic)