{"record":{"id":"43931a4110f01547","repo":"zed-industries/zed","slug":"slack-webhook-guild-internal-is-not-set","errorCode":null,"errorMessage":"SLACK_WEBHOOK_GUILD_INTERNAL is not set","messagePattern":"SLACK_WEBHOOK_GUILD_INTERNAL is not set","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"script/github-guild-board.py","lineNumber":400,"sourceCode":"def escape_slack(text):\n    # Escape Slack's control characters (&, <, >) so free text like issue/PR\n    # titles and comment bodies renders literally instead of being interpreted\n    # as a link or @-mention. send_slack can't do this wholesale because its own\n    # messages legitimately contain <url|text> links and *bold* markup.\n    # quote=False keeps it to Slack's three characters (no \" or ' escaping).\n    return html.escape(text or \"\", quote=False)\n\n\ndef slack_link(url, text):\n    # The single way to embed a titled link, so the title is always escaped\n    # without every caller having to remember to do it.\n    return f\"<{url}|{escape_slack(text)}>\"\n\n\ndef send_slack(text):\n    webhook = os.environ.get(\"SLACK_WEBHOOK_GUILD_INTERNAL\")\n    if not webhook:\n        raise RuntimeError(\"SLACK_WEBHOOK_GUILD_INTERNAL is not set\")\n    message = f\"{random.choice(ZEDGAR_QUIPS)} {text}\"\n    response = requests.post(\n        webhook,\n        json={\n            \"text\": message,\n            \"blocks\": [{\"type\": \"section\", \"text\": {\"type\": \"mrkdwn\", \"text\": message}}],\n        },\n        timeout=30,\n    )\n    if response.status_code != 200:\n        raise RuntimeError(\n            f\"Slack webhook returned {response.status_code}: {response.text[:200]}\"\n        )\n\n\ndef parse_dt(value):\n    return datetime.fromisoformat(value.replace(\"Z\", \"+00:00\"))\n","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/zed-industries/zed/blob/bc538def4545534201bbfcac4e95ac34ea6501b6/script/github-guild-board.py#L382-L418","documentation":"send_slack reads SLACK_WEBHOOK_GUILD_INTERNAL from the environment and refuses to operate without it: the guild board posts its summary through that Slack incoming webhook. This is a deployment/configuration error — the process environment (usually a CI secret) does not define the variable at the moment the script wants to notify.","triggerScenarios":"The CI workflow step omits env: SLACK_WEBHOOK_GUILD_INTERNAL; the secret was renamed or never created in the repo/org settings; running the script locally without exporting the variable.","commonSituations":"Workflow yaml edited and the env block dropped; secret-name typo (e.g. SLACK_WEBHOOK vs SLACK_WEBHOOK_GUILD_INTERNAL); contributors running scripts locally without the internal webhook.","solutions":["Create the secret in repo/org settings and map it in the workflow step: env: SLACK_WEBHOOK_GUILD_INTERNAL: ${{ secrets.SLACK_WEBHOOK_GUILD_INTERNAL }}","Locally: export SLACK_WEBHOOK_GUILD_INTERNAL=https://hooks.slack.com/services/T.../B.../... before running","Validate required env vars at script startup so the failure names the missing config immediately","Consider making the Slack post non-fatal (log and continue) if the board update itself already succeeded"],"exampleFix":"// before\ndef send_slack(text):\n    webhook = os.environ.get(\"SLACK_WEBHOOK_GUILD_INTERNAL\")\n    if not webhook:\n        raise RuntimeError(\"SLACK_WEBHOOK_GUILD_INTERNAL is not set\")\n\n// after\ndef main():\n    if not os.environ.get(\"SLACK_WEBHOOK_GUILD_INTERNAL\"):\n        raise SystemExit(\"SLACK_WEBHOOK_GUILD_INTERNAL is not set; cannot post the guild board summary\")","handlingStrategy":"validation","validationCode":"def required_env_present(names: list[str]) -> bool:\n    return all(os.environ.get(n) for n in names)","typeGuard":"def slack_webhook_is_configured() -> bool:\n    return bool(os.environ.get(\"SLACK_WEBHOOK_GUILD_INTERNAL\"))","tryCatchPattern":"try:\n    send_slack(summary)\nexcept RuntimeError as exc:\n    if \"is not set\" in str(exc):\n        log(f\"Skipping Slack notification: {exc}\")\n    else:\n        raise","preventionTips":["Declare required env vars at the top of CI workflows with comments","Validate env at process start, not at first notification","Name secrets exactly as the script reads them","Consider degrading gracefully: log the summary when the webhook is absent"],"tags":["slack","environment","config","ci","python"],"backgroundTag":null,"analyzedSha":"bc538def4545534201bbfcac4e95ac34ea6501b6","analyzedAt":"2026-08-16T07:30:46.435Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}