{"record":{"id":"b1abc30e15db6224","repo":"affaan-m/ECC","slug":"workflow-needs-at-least-one-numbered-genre","errorCode":null,"errorMessage":"workflow needs at least one numbered genre","messagePattern":"workflow needs at least one numbered genre","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/workflow.py","lineNumber":545,"sourceCode":"    config = json.loads(config_path.read_text(encoding=\"utf-8\"))\n    probe = probe or probe_media\n\n    def resolve_input(raw_path: str) -> Path:\n        candidate = Path(raw_path).expanduser()\n        if not candidate.is_absolute():\n            candidate = config_path.parent / candidate\n        return Path(os.path.abspath(candidate))\n\n    if config.get(\"schema_version\") != 1:\n        raise ValueError(\"workflow schema_version must be 1\")\n    if config.get(\"dry_run\", True) is not True:\n        raise ValueError(\"workflow requires dry_run=true; provider execution is disabled\")\n    source_policy = config.get(\"source_availability_policy\", \"allow_unavailable\")\n    if source_policy not in {\"allow_unavailable\", \"require_available\"}:\n        raise ValueError(\"source_availability_policy must be allow_unavailable or require_available\")\n    genres = sorted(config.get(\"genres\", []), key=lambda item: item[\"number\"])\n    if not genres:\n        raise ValueError(\"workflow needs at least one numbered genre\")\n\n    output = _SafeOutput(out_dir)\n    output.prepare((\"genres\", \"manifests\", \"resolve\"))\n\n    references: list[dict[str, Any]] = []\n    specs: list[dict[str, Any]] = []\n    manifests: dict[str, dict[str, Any]] = {\n        modality: {\n            \"schema_version\": 1,\n            \"modality\": modality,\n            \"dry_run\": True,\n            \"submit\": False,\n            \"provider_calls\": 0,\n            \"provider_execution\": False,\n            \"requests\": [],\n        }\n        for modality in _MODALITIES\n    }","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/workflow.py#L527-L563","documentation":"run_workflow requires config['genres'] to be a non-empty list after sorting by each item's 'number' key. An empty genres list (or missing key defaulting to []) fails this check, since the workflow has nothing to emit manifests for.","triggerScenarios":"Calling run_workflow with config lacking 'genres', or with genres=[] or genres=None.","commonSituations":"Generated config from a template that left genres unpopulated; a JSON workflow file where the genres array was emptied; forgetting to merge genre entries when constructing config programmatically.","solutions":["Add at least one genre dict to config['genres'], each with 'number', 'slug' and 'references' keys","Check that the JSON/YAML workflow file actually contains a populated genres array","Ensure the config-merging code does not overwrite a populated genres list with []"],"exampleFix":"// before\nconfig = {'schema_version': 1, 'dry_run': True, 'genres': []}\n// after\nconfig = {'schema_version': 1, 'dry_run': True, 'genres': [{'number': 1, 'slug': 'noir', 'references': []}]}","handlingStrategy":"validation","validationCode":"genres = config.get('genres') or []\nif not genres:\n    raise ValueError('config.genres must contain at least one genre')","typeGuard":"def has_genres(config) -> bool:\n    g = config.get('genres')\n    return isinstance(g, list) and len(g) > 0 and all(isinstance(x, dict) for x in g)","tryCatchPattern":"try:\n    run_workflow(config, out_dir)\nexcept ValueError as e:\n    if 'at least one numbered genre' in str(e):\n        raise UserInputError('Populate the genres array in your workflow file') from e\n    raise","preventionTips":["Validate the whole config with a JSON schema requiring minItems: 1 on genres","Never build genre lists imperatively after run_workflow is invoked; build first, then run","Keep a sample working config as a template"],"tags":["validation","configuration","empty-list"],"backgroundTag":"empty-required-field","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}