Skip to content

TUI/CLI accepts INSULT as a contentFilter value, fails CFN deploy with ValidationException #1571

Closed

Description

@notgitika

What happens

agentcore add policy ... --form-category contentFilter --form-filters INSULT succeeds locally, but agentcore deploy then fails at the CFN service:

Resource handler returned message: "Invalid category 'INSULT' for guardrail 'BedrockGuardrails::ContentFilter'.
Valid categories: VIOLENCE, HATE, SEXUAL, MISCONDUCT, INSULTS.
(Service: Bedrock AgentCore Control; Operation: CreatePolicy; Status Code: 400; Error Code: ValidationException)"

The TUI form offers INSULT as a selectable filter and the non-interactive CLI accepts it without complaint.

Repro

agentcore add policy --name MyPolicyEngine1 \
  --engine MyPolicyEngine1 \
  --form-category contentFilter \
  --form-filters INSULT \
  --form-effect forbid \
  --validation-mode IGNORE_ALL_FINDINGS \
  --enforcement-mode ACTIVE
# → Added policy 'MyPolicyEngine1' to engine 'MyPolicyEngine1'
agentcore deploy
# → CFN: Invalid category 'INSULT'... Valid categories: VIOLENCE, HATE, SEXUAL, MISCONDUCT, INSULTS.

--form-filters INSULTS (plural) deploys cleanly — confirms it's just a typo, not a missing feature.

Root cause

src/cli/tui/screens/policy/types.ts:15:

export const CONTENT_FILTER_FILTERS = ['VIOLENCE', 'HATE', 'SEXUAL', 'MISCONDUCT', 'INSULT'] as const;

Should be 'INSULTS' (plural) to match the service's accepted enum. src/cli/tui/screens/policy/__tests__/synthesize-cedar.test.ts uses the same singular form so it doesn't catch the mismatch.

Fix

  • CONTENT_FILTER_FILTERS in types.ts → change 'INSULT' to 'INSULTS'.
  • Update the synthesize-cedar tests that reference INSULT (none currently do directly — the existing tests only use VIOLENCE/HATE, but worth adding one with INSULTS to lock the canonical name in).

Note (out of scope, separate issue worth filing)

There's no client-side validation on --form-filters at all — it accepts any string. agentcore add policy --form-filters NOTAREALCATEGORY succeeds and only fails at deploy time. Worth tightening once we have the right enum.

Activity

  1. notgitika commented on Jun 18, 2026

    @notgitika
    ContributorAuthor

    I don't think we need client side validation for everything (as it's an enum and can be updated) but for the options we offer in TUI, we should make sure those are correct

  2. added a commit that references this issue on Jun 18, 2026
    5fe72af
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions