{"record":{"id":"430cce6034ae76bf","repo":"affaan-m/ECC","slug":"source-availability-policy-must-be-allow-unavailable-or","errorCode":null,"errorMessage":"source_availability_policy must be allow_unavailable or require_available","messagePattern":"source_availability_policy must be allow_unavailable or require_available","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/taste-application/scripts/tasteforge/workflow.py","lineNumber":542,"sourceCode":"    \"\"\"Execute the deterministic offline contract and return its receipt.\"\"\"\n    config_path = Path(config_path)\n    out_dir = Path(out_dir)\n    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\": [],","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/skills/taste-application/scripts/tasteforge/workflow.py#L524-L560","documentation":"run_workflow validates the workflow config dict before doing any work. The source_availability_policy key must be exactly one of the two allowed strings, 'allow_unavailable' or 'require_available'; anything else (typo, wrong case, wrong type like None or true) raises this ValueError. It exists because the policy controls whether missing source files are tolerated downstream.","triggerScenarios":"Passing config['source_availability_policy'] set to any value other than 'allow_unavailable' or 'require_available' — e.g. 'Require_Available', 'required', None, a boolean, or omitting quotes in a JSON config.","commonSituations":"Hand-edited config files with a typo or wrong casing; programmatic config built with a raw string that was never validated; YAML/JSON config where the field was set to a boolean like true instead of a string.","solutions":["Set source_availability_policy to exactly 'allow_unavailable' (default) or 'require_available', lowercase string","If the key was meant to be omitted, remove it — the default is 'allow_unavailable'","Validate the value in your config loader before calling run_workflow"],"exampleFix":"// before\nconfig = {'schema_version': 1, 'dry_run': True, 'source_availability_policy': 'require'}\n// after\nconfig = {'schema_version': 1, 'dry_run': True, 'source_availability_policy': 'require_available'}","handlingStrategy":"validation","validationCode":"ALLOWED_POLICIES = {'allow_unavailable', 'require_available'}\nif config.get('source_availability_policy', 'allow_unavailable') not in ALLOWED_POLICIES:\n    raise ValueError('source_availability_policy must be allow_unavailable or require_available')","typeGuard":"def is_valid_policy(v) -> bool:\n    return isinstance(v, str) and v in {'allow_unavailable', 'require_available'}","tryCatchPattern":"try:\n    run_workflow(config, out_dir)\nexcept ValueError as e:\n    if 'source_availability_policy' in str(e):\n        config['source_availability_policy'] = 'allow_unavailable'\n        run_workflow(config, out_dir)\n    else:\n        raise","preventionTips":["Use a literal or enum constant for the policy value instead of a raw string","Load workflow configs through a schema validator (pydantic/jsonschema) with an enum field","Copy policy values from existing working configs"],"tags":["validation","configuration","valueerror"],"backgroundTag":"invalid-enum-value","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"}