affaan-m/ECC · error · KeyError
Missing 'scoring' section in compliance spec
Error message
Missing 'scoring' section in compliance spec
What it means
After parsing the steps list, parse_spec() requires a top-level 'scoring' map and reads raw['scoring']['threshold_promote_to_hook']. If 'scoring' is absent it raises KeyError with this message; if 'scoring' exists but lacks 'threshold_promote_to_hook' the subsequent subscript raises a plain KeyError instead. This message specifically means the entire scoring block is missing from the YAML.
Source
Thrown at skills/skill-comply/scripts/parser.py:98
raise FileNotFoundError(f"Spec file not found: {path}")
raw = yaml.safe_load(path.read_text())
steps: list[Step] = []
for s in raw["steps"]:
d = s["detector"]
steps.append(Step(
id=s["id"],
description=s["description"],
required=s["required"],
detector=Detector(
description=d["description"],
after_step=d.get("after_step"),
before_step=d.get("before_step"),
),
))
if "scoring" not in raw:
raise KeyError("Missing 'scoring' section in compliance spec")
return ComplianceSpec(
id=raw["id"],
name=raw["name"],
source_rule=raw["source_rule"],
version=raw["version"],
steps=tuple(steps),
threshold_promote_to_hook=raw["scoring"]["threshold_promote_to_hook"],
)
View on GitHub (pinned to 01e15490f0)
Solutions
- Open the spec and add a top-level 'scoring:' block with 'threshold_promote_to_hook: <float>'.
- If using spec_generator, raise max_retries or switch to a stronger model so the produced YAML is complete.
- Validate the spec against a schema/example before passing it to parse_spec.
- Check YAML indentation — scoring must be a sibling of 'steps', not nested under it.
Example fix
# before
id: skill-x
name: Skill X
steps:
- id: s1
description: ...
required: true
detector:
description: ...
# after
id: skill-x
name: Skill X
steps:
- id: s1
description: ...
required: true
detector:
description: ...
scoring:
threshold_promote_to_hook: 0.8 Defensive patterns
Strategy: validation
Validate before calling
import yaml
from pathlib import Path
def validate_spec_has_scoring(path: Path) -> None:
raw = yaml.safe_load(path.read_text())
if 'scoring' not in raw or 'threshold_promote_to_hook' not in raw['scoring']:
raise SystemExit('spec missing scoring.threshold_promote_to_hook') Try / catch
from scripts.parser import parse_spec
try:
spec = parse_spec(path)
except KeyError as e:
if 'scoring' in str(e):
raise SystemExit('add a scoring.threshold_promote_to_hook block to the spec') from e
raise Prevention
- Keep a canonical example spec next to the parser and diff new specs against it.
- When using spec_generator, log the produced YAML so missing sections are visible before parse_spec runs.
- Write a jsonschema/pydantic model for ComplianceSpec and validate raw YAML before parse_spec.
When it happens
Trigger: An LLM-generated spec (from spec_generator) omitted the scoring block; a hand-edited spec deleted the section; the key was misspelled (e.g. 'score' or 'Score').
Common situations: spec_generator retries failed and the final attempt still produced incomplete YAML; a spec template was copied without the scoring section; YAML indentation put scoring under another key.
Related errors
- Spec file not found: {path}
- Missing required field {e} at line {i}
- Invalid install-state (${label}): ${details}
- Install module ${moduleId} has invalid targets; expected an
- Invalid install-state${label ? ` (${label})` : ''}: ${format
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/0975839f5635cf49.
Report an issue: GitHub.