affaan-m/ECC · error · ValueError

Missing required field

Error message

Missing required field {e} at line {i}

What it means

KeyError guard in parse_trace: an event line parsed as JSON but is missing one of the required fields (timestamp, event, tool, or session). The missing field name and line number are included in the message.

Solutions

  1. Add the named required field to the event object on the reported line
  2. Check the observation schema docs for the full required-field list
  3. Regenerate the trace with a recorder version that emits all required fields
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at skills/skill-comply/scripts/parser.py:72 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/9a490c214563a2d8. Report an issue: GitHub.

Appendix: source

Thrown at skills/skill-comply/scripts/parser.py:72

        return []

    events: list[ObservationEvent] = []
    for i, line in enumerate(text.splitlines(), 1):
        try:
            raw = json.loads(line)
        except json.JSONDecodeError as e:
            raise ValueError(f"Invalid JSON at line {i}: {e}") from e
        try:
            events.append(ObservationEvent(
                timestamp=raw["timestamp"],
                event=raw["event"],
                tool=raw["tool"],
                session=raw["session"],
                input=raw.get("input", ""),
                output=raw.get("output", ""),
            ))
        except KeyError as e:
            raise ValueError(f"Missing required field {e} at line {i}") from e

    return sorted(events, key=lambda e: e.timestamp)


def parse_spec(path: Path) -> ComplianceSpec:
    """Parse a YAML compliance spec file."""
    if not path.is_file():
        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(

View on GitHub (pinned to 8321021c54)