nextlevelbuilder/ui-ux-pro-max-skill · error · ValueError
action must use a known prefix: {}
Error message
action must use a known prefix: {} What it means
First check in _validate_action: every action must be a string containing a ':' separator, because actions are parsed as prefix:value (prefix in {constraint, style, pattern, mode}). Non-strings, strings without a colon, or empty values like "mode:" pattern-split failures all raise here with the offending action echoed.
Source
Thrown at src/ui-ux-pro-max/scripts/reasoning_contract.py:89
except json.JSONDecodeError as error:
raise ValueError("invalid decision-rule JSON: {}".format(error)) from error
if not isinstance(rules, dict):
raise ValueError("decision rules must be a JSON object")
for condition, actions in rules.items():
if condition not in ALLOWED_CONDITIONS:
raise ValueError("unknown decision-rule condition: {}".format(condition))
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(View on GitHub (pinned to a38d04c3d5)
Solutions
- Write every action as prefix:value, e.g. "mode:dark", "style:minimal", "pattern:hero-split", "constraint:no-large-images".
- Quote all actions in the JSON payload so they stay strings.
- Replace separators: 'mode dark' -> 'mode:dark'.
Example fix
// before
{"must_have": ["dark", 42]}
// after
{"must_have": ["mode:dark"]} Defensive patterns
Strategy: validation
Validate before calling
from src.ui_ux_pro_max.scripts.reasoning_contract import ACTION_PREFIXES
import json
for cond, actions in json.loads(raw).items():
for a in actions:
if not isinstance(a, str) or ':' not in a or a.split(':', 1)[0] not in ACTION_PREFIXES:
raise ValueError(f"{cond}: malformed action {a!r}; use prefix:value with prefix in {sorted(ACTION_PREFIXES)}") Type guard
def is_wellformed_action(a) -> bool:
return isinstance(a, str) and ":" in a and a.split(":", 1)[0] in {"constraint", "style", "pattern", "mode"} Prevention
- Provide a snippet library of the four valid action shapes for rule authors.
- Validate actions at authoring time (spreadsheet macro or lint script), not only at parse time.
When it happens
Trigger: _validate_action receives 42 (int), None, "mode dark" (space instead of colon), "dark" (missing prefix), or "" — reached via parse_decision_rules validating every element of each condition's action array.
Common situations: Mixing action dialects (some systems use space-separated tokens); YAML/JSON autotyping turning a quoted action into a number; forgetting the prefix when authoring 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/a0a55de63320e217.
Report an issue: GitHub.