nextlevelbuilder/ui-ux-pro-max-skill · error · ValueError
pattern action must name a pattern
Error message
pattern action must name a pattern
What it means
Actions with the pattern: prefix must carry a non-empty, non-whitespace-only value (checked via value.strip()). A bare "pattern:" or "pattern: " passes the ':' split and prefix check but names no layout pattern, so the rule could never resolve to a pattern at apply time — hence rejected up front.
Source
Thrown at src/ui-ux-pro-max/scripts/reasoning_contract.py:96
if not isinstance(actions, list) or not actions:
raise ValueError("{} must map to a non-empty action array".format(condition))
for action in actions:
_validate_action(action)
if len(actions) != len(set(actions)):
raise ValueError("{} contains duplicate actions".format(condition))
return rules
def _validate_action(action):
if not isinstance(action, str) or ":" not in action:
raise ValueError("action must use a known prefix: {}".format(action))
prefix, value = action.split(":", 1)
if prefix not in ACTION_PREFIXES:
raise ValueError("unknown decision-rule action: {}".format(action))
if prefix in TOKEN_ACTION_PREFIXES and not TOKEN_RE.fullmatch(value):
raise ValueError("invalid {} action value: {}".format(prefix, value))
if prefix == "pattern" and not value.strip():
raise ValueError("pattern action must name a pattern")
if prefix == "mode" and value not in {"dark", "light"}:
raise ValueError("mode action must be dark or light")
def apply_decision_rules(rules, query):
"""Return deterministic mutations and an audit trail; never execute data."""
normalized = str(query or "").casefold()
result = {"activated": [], "style_ids": [], "constraints": [],
"pattern": None, "mode": None}
for condition, actions in rules.items():
active = condition == "must_have" or any(
pattern.search(normalized)
for pattern in CONDITION_PATTERNS.get(condition, ()))
if not active:
continue
result["activated"].append({"condition": condition, "actions": list(actions)})
for action in actions:
prefix, value = action.split(":", 1)View on GitHub (pinned to a38d04c3d5)
Solutions
- Fill in a concrete pattern name, e.g. "pattern:hero-split" or "pattern:card-grid".
- If no pattern is intended, delete the whole pattern: action from the array (arrays just must stay non-empty overall).
- Lint payloads with parse_decision_rules before committing so empty placeholders fail fast.
Example fix
// before
{"if_hero_needed": ["pattern:"]}
// after
{"if_hero_needed": ["pattern:hero-split"]} Defensive patterns
Strategy: validation
Validate before calling
for a in all_actions:
prefix, _, value = a.partition(":")
if prefix == "pattern" and not value.strip():
raise ValueError(f"pattern action missing a name: {a!r}") Prevention
- Ban placeholder actions in review: run a lint that rejects values matching r'^\s*$'.
- Fill template rule blocks completely or delete the action before saving.
When it happens
Trigger: _validate_action("pattern:"), _validate_action("pattern: ") — i.e. a decision-rule JSON containing a pattern action whose value was never filled in or was lost in editing.
Common situations: Template rule blocks where the pattern name is a placeholder; truncation of a CSV cell mid-action; deleting the value but leaving the prefix while refactoring rules.
Related errors
- duplicate decision-rule key: {}
- decision rules must be a JSON object
- unknown decision-rule condition: {}
- {} must map to a non-empty action array
- {} contains duplicate actions
AI-assisted analysis of nextlevelbuilder/ui-ux-pro-max-skill@a38d04c3d5 (2026-08-14).
Data as JSON: /api/errors/20f61bbb3117cce0.
Report an issue: GitHub.