{"record":{"id":"a0885d9bf55e3fb9","repo":"zed-industries/zed","slug":"unknown-guild-mode-mode","errorCode":null,"errorMessage":"Unknown GUILD_MODE: {mode}","messagePattern":"Unknown GUILD_MODE: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"script/github-guild-board.py","lineNumber":726,"sourceCode":"    GITHUB_HEADERS = {\n        \"Authorization\": f\"Bearer {os.environ['GITHUB_TOKEN']}\",\n        \"Accept\": \"application/vnd.github+json\",\n        \"X-GitHub-Api-Version\": \"2022-11-28\",\n    }\n\n    NOW = datetime.now(timezone.utc)\n\n    project_number = int(os.environ[\"PROJECT_NUMBER\"])\n    mode = os.environ[\"GUILD_MODE\"]\n\n    if mode == \"event\":\n        run_event(project_number)\n    elif mode == \"stale\":\n        run_stale(project_number)\n    elif mode == \"weekly\":\n        run_weekly(project_number)\n    else:\n        raise RuntimeError(f\"Unknown GUILD_MODE: {mode}\")\n","sourceCodeStart":708,"sourceCodeEnd":727,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/script/github-guild-board.py#L708-L727","documentation":"main dispatches on the GUILD_MODE environment variable and accepts only \"event\", \"stale\", or \"weekly\"; any other value raises. An unset variable is a different, earlier failure (KeyError from os.environ[\"GUILD_MODE\"]), so this error specifically means set-but-unknown: a typo, wrong case, stray whitespace from yaml, or a mode this script version does not implement.","triggerScenarios":"GUILD_MODE=Event (wrong case), GUILD_MODE=daily (never implemented), a trailing newline or space inherited from a workflow yaml expression, or a mode name removed/renamed in a refactor of run_event/run_stale/run_weekly.","commonSituations":"Workflow updated to a new mode name while the deployed script still expects the old ones; copy-paste typos in CI env blocks; contributors guessing mode names.","solutions":["Set GUILD_MODE to exactly event, stale, or weekly","Strip whitespace when reading: os.environ['GUILD_MODE'].strip()","List the valid modes in the error message so the fix is obvious","Validate all required env (PROJECT_NUMBER, GUILD_MODE) at startup, before any network calls"],"exampleFix":"// before\nmode = os.environ[\"GUILD_MODE\"]\nif mode == \"event\":\n    run_event(project_number)\nelif mode == \"stale\":\n    run_stale(project_number)\nelif mode == \"weekly\":\n    run_weekly(project_number)\nelse:\n    raise RuntimeError(f\"Unknown GUILD_MODE: {mode}\")\n\n// after\nmodes = {\"event\": run_event, \"stale\": run_stale, \"weekly\": run_weekly}\nmode = os.environ[\"GUILD_MODE\"].strip()\nif mode not in modes:\n    raise RuntimeError(f\"Unknown GUILD_MODE: {mode!r}; expected one of {sorted(modes)}\")\nmodes[mode](project_number)","handlingStrategy":"validation","validationCode":"VALID_GUILD_MODES = {\"event\", \"stale\", \"weekly\"}\n\ndef guild_mode_is_valid(mode: str) -> bool:\n    return mode.strip() in VALID_GUILD_MODES","typeGuard":"def is_known_guild_mode(mode: str) -> bool:\n    return mode.strip() in {\"event\", \"stale\", \"weekly\"}","tryCatchPattern":"mode = os.environ[\"GUILD_MODE\"].strip()\ntry:\n    assert mode in VALID_GUILD_MODES, f\"Unknown GUILD_MODE: {mode!r}; expected {sorted(VALID_GUILD_MODES)}\"\nexcept AssertionError as exc:\n    raise SystemExit(str(exc))","preventionTips":["Validate env vars at startup before any network calls","Strip whitespace when reading mode strings from CI","List valid values in the error message","Keep workflow mode names and script dispatch keys in one reviewed place"],"tags":["environment","config","dispatch","python"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}