{"record":{"id":"91e131cdb9c996f5","repo":"zed-industries/zed","slug":"option-option-name-not-found-in-field-field","errorCode":null,"errorMessage":"Option '{option_name}' not found in field '{field_name}'. Available: {available}","messagePattern":"Option '(.+?)' not found in field '(.+?)'\\. Available: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"script/github-community-pr-board.py","lineNumber":563,"sourceCode":"            for option in field.get(\"options\", []):\n                if option[\"name\"] == option_name:\n                    option_id = option[\"id\"]\n                    break\n            break\n\n    if not field_id:\n        available = [f[\"name\"] for f in project[\"fields\"][\"nodes\"] if \"name\" in f]\n        raise RuntimeError(\n            f\"Field '{field_name}' not found on project. Available: {available}\"\n        )\n    if not option_id:\n        available = [\n            opt[\"name\"]\n            for f in project[\"fields\"][\"nodes\"]\n            if f.get(\"name\") == field_name\n            for opt in f.get(\"options\", [])\n        ]\n        raise RuntimeError(\n            f\"Option '{option_name}' not found in field '{field_name}'. \"\n            f\"Available: {available}\"\n        )\n\n    github_graphql(\n        \"\"\"\n        mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) {\n          updateProjectV2ItemFieldValue(input: {\n            projectId: $projectId\n            itemId: $itemId\n            fieldId: $fieldId\n            value: { singleSelectOptionId: $optionId }\n          }) {\n            projectV2Item { id }\n          }\n        }\n        \"\"\",\n        {","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/script/github-community-pr-board.py#L545-L581","documentation":"The single-select field lookup succeeded but none of its options equals option_name. The updateProjectV2ItemFieldValue mutation needs an option id, so an unknown option name cannot be written and the script aborts, listing the option names the field actually has. Like the field check, this is exact string matching and therefore sensitive to renames, case, and whitespace.","triggerScenarios":"set_field runs with option_name like \"In Progress\" while the board field's options are [\"Todo\", \"In Review\", \"Done\"]; the option was renamed or removed on the board; the script's state-to-option mapping contains a state never added to the field.","commonSituations":"Team renames workflow statuses; triage-state vocabulary changes without updating the board; typos or trailing whitespace differences (\"Done \" vs \"Done\").","solutions":["Pick the correct option from the Available list in the error and update the script's mapping","If the new state is legitimate, add the option to the field on the GitHub project (board UI or API) first","Normalize whitespace and case before comparing option names","Assert the expected options exist at startup together with the field checks"],"exampleFix":"// before\nfor option in field.get(\"options\", []):\n    if option[\"name\"] == option_name:\n        option_id = option[\"id\"]\n        break\n\n// after\nfor option in field.get(\"options\", []):\n    if option[\"name\"].strip().lower() == option_name.strip().lower():\n        option_id = option[\"id\"]\n        break","handlingStrategy":"validation","validationCode":"def field_has_option(project: dict, field_name: str, option_name: str) -> bool:\n    for field in project[\"fields\"][\"nodes\"]:\n        if field.get(\"name\") == field_name:\n            return any(o.get(\"name\") == option_name for o in field.get(\"options\", []))\n    return False","typeGuard":"def is_valid_option(field: dict, option_name: str) -> bool:\n    return any(o.get(\"name\") == option_name for o in field.get(\"options\", []))","tryCatchPattern":"try:\n    set_field(project, item_id, STATUS_FIELD, option)\nexcept RuntimeError as exc:\n    if \"not found in field\" in str(exc):\n        log(f\"Option drift: {exc}; available statuses need a mapping update\")\n    else:\n        raise","preventionTips":["Validate the whole option vocabulary at startup, not per item","Add new workflow states to the board before shipping script versions that use them","Normalize whitespace and case when comparing option names","Surface the available list in errors for quick triage"],"tags":["github-projects","graphql","config-drift","python"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}