{"record":{"id":"f70e430f14bf5b76","repo":"abi/screenshot-to-code","slug":"invalid-brief-entry-in-set-name-id-brief-id-r","errorCode":null,"errorMessage":"Invalid brief entry in {set_name}: id={brief_id!r}","messagePattern":"Invalid brief entry in (.+?): id=(.+?)","errorType":"exception","errorClass":"InvalidSetNameError","httpStatus":null,"severity":"error","filePath":"backend/evals/sets.py","lineNumber":119,"sourceCode":"        raise EvalSetNotFoundError(f\"Text eval set not found: {set_name}\")\n    try:\n        with open(path, \"r\", encoding=\"utf-8\") as f:\n            loaded = cast(dict[str, Any], json.load(f))\n    except (OSError, json.JSONDecodeError) as exc:\n        raise EvalSetNotFoundError(f\"Unreadable briefs.json for {set_name}: {exc}\")\n    briefs: list[EvalSetBrief] = []\n    raw_briefs = loaded.get(\"briefs\")\n    entries = (\n        cast(list[object], raw_briefs) if isinstance(raw_briefs, list) else []\n    )\n    for entry in entries:\n        if not isinstance(entry, dict):\n            continue\n        record = cast(dict[str, Any], entry)\n        brief_id = str(record.get(\"id\") or \"\")\n        brief = str(record.get(\"brief\") or \"\")\n        if not _BRIEF_ID_PATTERN.match(brief_id) or not brief:\n            raise InvalidSetNameError(\n                f\"Invalid brief entry in {set_name}: id={brief_id!r}\"\n            )\n        briefs.append(\n            EvalSetBrief(\n                id=brief_id,\n                title=str(record.get(\"title\") or brief_id),\n                brief=brief,\n                tests=str(record.get(\"tests\") or \"\"),\n            )\n        )\n    return briefs\n\n\ndef _load_manifest(set_name: str) -> dict[str, Any]:\n    try:\n        with open(_manifest_path(set_name), \"r\", encoding=\"utf-8\") as f:\n            loaded = cast(Any, json.load(f))\n            if isinstance(loaded, dict):","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/abi/screenshot-to-code/blob/d026163f586dfa8c5c10d28c36edd59a9d3b0e88/backend/evals/sets.py#L101-L137","documentation":"Raised while parsing briefs.json for a text eval set: an entry's `id` fails the pattern ^[a-z0-9][a-z0-9-]*$ or its `brief` field is empty. The loader (list_set_briefs) iterates `briefs` entries and hard-fails on the first invalid one, refusing to serve a partially malformed set. It surfaces as InvalidSetNameError even though the real problem is entry content, not the set name.","triggerScenarios":"Calling list_set_briefs(set_name) when sets/{name}/briefs.json contains an entry with id like \"My Brief\", \"brief_1\" (underscore), leading hyphen, or an empty/missing id, or an entry whose `brief` value is \"\"/missing. Non-dict entries are skipped silently; only dict entries with bad ids/empty briefs trigger it.","commonSituations":"Hand-editing briefs.json with capitalized or underscore ids; copy-pasting ids from filenames; an entry that has a title but the author forgot the `brief` body; upstream tooling that generates ids with UUID format (dashes ok but letters uppercase).","solutions":["Fix the offending entry id to lowercase alphanumerics and hyphens only, starting with a-z or 0-9 (e.g. \"landing-page-1\").","Add or fill in a non-empty `brief` string for the entry named in the message.","Validate briefs.json with the same regex before dropping it into sets/{name}/.","If the entry is junk, remove it entirely (non-dict entries are ignored, but a dict with bad fields is fatal)."],"exampleFix":"// before (briefs.json)\n{\"briefs\": [{\"id\": \"Brief_1\", \"title\": \"Landing\", \"brief\": \"...\"}]}\n\n// after\n{\"briefs\": [{\"id\": \"brief-1\", \"title\": \"Landing\", \"brief\": \"...\"}]}","handlingStrategy":"validation","validationCode":"import json, re\n\nBRIEF_ID = re.compile(r\"^[a-z0-9][a-z0-9-]*$\")\n\ndef validate_briefs_file(path: str) -> list[str]:\n    problems = []\n    data = json.loads(open(path, encoding=\"utf-8\").read())\n    for i, entry in enumerate(data.get(\"briefs\", [])):\n        if not isinstance(entry, dict):\n            continue\n        if not BRIEF_ID.match(str(entry.get(\"id\") or \"\")):\n            problems.append(f\"entry {i}: bad id {entry.get('id')!r}\")\n        if not str(entry.get(\"brief\") or \"\").strip():\n            problems.append(f\"entry {i}: empty brief\")\n    return problems","typeGuard":null,"tryCatchPattern":"try:\n    briefs = list_set_briefs(set_name)\nexcept InvalidSetNameError as e:\n    # message names the offending id; fix briefs.json\n    log.error(\"briefs.json invalid for %s: %s\", set_name, e)\n    return []","preventionTips":["Lint briefs.json with the same ^[a-z0-9][a-z0-9-]*$ id regex before adding it to a set","Generate ids with slugify-style tooling so casing/underscores can't creep in","Treat a missing `brief` body as a schema error in authoring, not at load time"],"tags":["evals","json","validation","configuration"],"backgroundTag":null,"analyzedSha":"d026163f586dfa8c5c10d28c36edd59a9d3b0e88","analyzedAt":"2026-08-14T22:02:06.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}