◉ANTIGRAVITY LABJP
Articles/Integrations
⬡ Integrations/2026-07-19Advanced

The One File That Stops Startup: Guarding config.json Integrity Before Scheduled Runs

Antigravity 2.3.1 fixed a bug where an empty or corrupt config.json blocked startup. The symptom was fixed; the causes of corruption still live in your environment. Here is a three-layer guard — validate, snapshot, restore — that runs before a scheduled job, with working code and notes from running it nightly.

Antigravity392config.jsonconfiguration7automation94scheduled runs5resilience9

✦ Premium Article

One morning, a job I run overnight left nothing behind. The log held a single line: "could not start." The same steps that had run hundreds of times the day before had tripped on the very first one.

The cause was a single file. The config.json under ~/.gemini/config/ had gone empty. The agent tried to read a JSON file with no contents and simply could not come up. Nothing in my own code was wrong.

Antigravity 2.3.1 (July 16) fixes exactly this: it closes the case where "an empty or corrupt config.json prevents startup." I am grateful for the fix. But what was fixed is the symptom — failing to start on a broken config. The reasons a config gets broken in the first place still live on our side. The more you let tasks run unattended, the less this first-step fragility feels like someone else's problem.

Why one file can stop startup

An agentic tool reads its configuration at launch: the model choice, the default permissions, connection details. Bundling all of that into one file like config.json trades convenience for a single point of fragility.

As long as that file is valid JSON, startup will proceed even if the contents are a little stale. The trouble comes when it is broken as JSON — a missing closing brace, a truncated write, or empty contents. The parser fails, and the state is not "no configuration" but "cannot read the configuration." Some tools fall back to defaults when a value is absent, but when the file is unreadable, judgment stops right there.

What I hit was the "gone empty" case. A write was interrupted partway, the old contents were cleared, and the new contents never fully landed. All that remained was a zero-byte file.

Know the failure modes first

Before designing defenses, it helps to look concretely at how the file breaks. Once you know the causes, you know where to place your hands.

FailureTypical causeWhat helps
Zero bytes / truncatedInterrupted write, disk fullAtomic writes, pre-run validation
Invalid JSONHand-edit slip, concurrent writesParse check, restore from known-good
Rolled back to old stateCloud-sync conflict resolutionGenerational snapshots, change detection
Missing keysSchema change, partial migrationMinimal schema check

As an indie developer running jobs overnight, I have felt this firsthand. In my own setup there was a period when the config directory sat inside a cloud-synced folder, and two machines wrote it separately; the sync side once left a half-finished file behind. On another occasion the disk filled briefly and a write never completed. None of these are tool bugs — they are events on the environment side. That is precisely why it is worth checking for yourself before each run, rather than waiting on a tool fix.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦A preflight guard that parses config.json and checks a minimal schema before startup, so a broken config never launches the agent
✦A three-layer design: fingerprint known-good states with sha256, keep only the last 3 generations, and restore via an atomic os.replace
✦A fail-safe that writes a minimal default when no good backup remains — plus the line where that one-time fallback must notify a human
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Antigravity Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ Integrations2026-09-20
antigravity-preview-05-2026 shuts down October 5: which setups need more than a string swap
The shutdown date for antigravity-preview-05-2026 is set for October 5, and the official page gives you the date and the successor name, nothing more. If you only read output_text, swapping the string is the whole migration. If you read steps, it is not.
⬡ Integrations2026-09-18
When a session starts with MCP tools missing, where do you stop?
When MCP initialization fails at startup, the agent quietly falls back to other means and keeps going. Here is a small script that asks your servers directly which tools they expose, plus the three branches I decided on in advance for when something is missing.
⬡ Integrations2026-09-12
Antigravity CLI 1.1.28 turns a print-timeout overrun into a successful exit — rechecking unattended runs
Since 1.1.28, an expired --print-timeout returns partial output and exits successfully instead of failing. Fetching an external URL now asks for approval first. Here is how I rebuilt an unattended pipeline that judged everything by the exit code.