{
  "id": 2506151,
  "title": "My Cost Monitor Said $234 When the Real Bill Was $48. Then set -e Made It Go Silent for a Week.",
  "url": "https://urgent.news/2026/08/22/my-cost-monitor-said-234-when-the-real-bill-was-48-then-set-e-made-it",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-22T05:00:06.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/bokuwalily/my-cost-monitor-said-234-when-the-real-bill-was-48-then-set-e-made-it-go-silent-for-a-week-475j"
  },
  "original_language": "en",
  "account": "A monitoring script that fails quietly is worse than having no monitoring at all. The user experienced this firsthand twice: first, the script reported a spend of $234 when the actual cost was $48, an overcount of 4-6 times due to double-summing cumulative log lines. Then, after hardening the script with set -euo pipefail, a timeout in ccusage caused the entire system to exit with an error message, leaving the status bar blank for a week during two 5-hour periods when critical thresholds were crossed without the user noticing. The fix in both cases was to adopt a fail-open design, printing \"⚫ n/a\" and exiting with a status of 0. This post walks through the 212-line script that manages the user's cost monitoring and the underlying design principle: preventing the dashboard from becoming silent. The script runs every 30 minutes, rendering its output into the user's status bar and terminal dashboard. If the monitoring script fails, the entire dashboard will also fail, rendering it useless. The user's solution is to design the script to fail-open, displaying \"⚫ n/a\" in case of errors, rather than going silent. This ensures that the user can quickly identify issues and prevent damage to their environment.",
  "summary": "A monitoring script that dies quietly is worse than no monitoring at all. Mine proved it twice: first it reported a 7-day spend of $234 when ccusage daily said the real number was $48 (a 4–6x overcount from double-summing cumulative log lines, now down to a 2.3% source-to-source gap), and then, after I \"hardened\" it with set -euo pipefail , a single ccusage timeout made the whole thing exit 1 and…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}