{"record":{"id":"597bf214a8657eff","repo":"zed-industries/zed","slug":"field-field-name-not-found-on-project-availab","errorCode":null,"errorMessage":"Field '{field_name}' not found on project. Available: {available}","messagePattern":"Field '(.+?)' not found on project\\. Available: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"script/github-community-pr-board.py","lineNumber":553,"sourceCode":"    return None\n\n\ndef github_set_project_field(project, item_id, field_name, option_name):\n    \"\"\"Set a single-select field on a project item.\"\"\"\n    field_id = None\n    option_id = None\n    for field in project[\"fields\"][\"nodes\"]:\n        if field.get(\"name\") == field_name:\n            field_id = field[\"id\"]\n            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: {","sourceCodeStart":535,"sourceCodeEnd":571,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/script/github-community-pr-board.py#L535-L571","documentation":"Before mutating a project item, the script looks up field_name among project[\"fields\"][\"nodes\"] (the fields fetched in the earlier project query). When no field carries that exact, case-sensitive name it raises, listing the field names that do exist. This is config drift between the script's expected field name and the live GitHub ProjectV2 board.","triggerScenarios":"The updateProjectV2ItemFieldValue flow runs with a field_name like \"Status\" that was renamed on the board (e.g. to \"Triage Status\"), or PROJECT_NUMBER points at a different project whose fields differ entirely, so the name lookup over fields.nodes fails.","commonSituations":"Maintainers rename board fields during a process change; the project is recreated from a template with different field names; script constants lag behind the board; case mismatch (\"status\" vs \"Status\").","solutions":["Compare the expected name against the Available list in the error message (exact, case-sensitive) and update the script constant to the real name","Alternatively rename the field back on the GitHub project so the script's expectation holds","Verify the PROJECT_NUMBER env var points at the intended board","Add a startup assertion that all required fields exist before performing any mutations"],"exampleFix":"// before\nfield_id = None\nfor field in project[\"fields\"][\"nodes\"]:\n    if field.get(\"name\") == field_name:\n        field_id = field[\"id\"]\n        break\n\n// after\nboard_fields = {f[\"name\"] for f in project[\"fields\"][\"nodes\"] if f.get(\"name\")}\nmissing = {STATUS_FIELD, TRIAGE_FIELD} - board_fields\nif missing:\n    raise RuntimeError(f\"Board missing required fields {sorted(missing)}; has {sorted(board_fields)}\")","handlingStrategy":"validation","validationCode":"def required_fields_exist(project: dict, required: list[str]) -> bool:\n    names = {f.get(\"name\") for f in project[\"fields\"][\"nodes\"]}\n    return set(required) <= names","typeGuard":"def board_has_field(project: dict, field_name: str) -> bool:\n    return any(f.get(\"name\") == field_name for f in project[\"fields\"][\"nodes\"])","tryCatchPattern":"try:\n    set_field(project, item_id, STATUS_FIELD, option)\nexcept RuntimeError as exc:\n    if \"not found on project\" in str(exc):\n        log(f\"Board schema drifted: {exc}; skipping item {item_id}\")\n    else:\n        raise","preventionTips":["Assert required fields at startup, before mutations","Keep field-name constants in one place and reviewed during board changes","Treat board renames as script changes: update both together","Compare names case-sensitively by design and document it"],"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"}