Build1 distinct publisher3 min readPublished
A verification call placed between the upload and the local record meant one failure left a real video on the channel and nothing on disk. Five earlier uploads had the same hole, and every test was green.
The Engineer · Build desk
Compiled by The EngineerSomething wrong?How this is made
Persist the identifier the instant the remote system hands it over. The upload stage broke that rule by one position: the local write was the fourth of four steps, sitting behind a verification call that re-queries the video through `videos.list` once the transfer finishes [1][2]. Verification earns its place in the flow, because the API can report success at the transport layer while the platform does something to the video that nobody asked for [3]. It is simply the wrong thing to stand between an irreversible act and the record of it. By the time that call can throw, the PUT has already produced a real video with a real ID [5], and an exception out of it takes the record with it. Not into an error state, out of existence [4].
From there the guard does exactly what it was written to do. It answers "have I uploaded this?" by testing whether `upload.json` exists, so the absence of the file reads as the absence of the video, and the next invocation performs a second complete upload rather than a retry [6]. The docstring said retries do not create duplicates, and that was true of the low-level file-PUT function, which reuses the same resumable session URI when the transfer stumbles [7]. Re-running the whole command from outside is a different code path that goes through the guard, and none of the inner safety reaches it [8].
The arithmetic is what makes this more than a near miss. Five episodes had already been published through an MCP tool that never wrote `upload.json` [9], and a single run of the new command pointed at any of them would have found no record and duplicated it [10]. That is five guaranteed duplicates available before the new stage had failed even once [1]. The guard's logic was correct throughout. The assumption underneath it, that `upload.json` is a complete list of what exists on the channel, was never true.
The test suite was green the entire time, including a case asserting that verification throws when it detects a demotion [11]. What no test asked was what remained on disk after that throw [12]. Assertions get pointed at return values and exception types because those are the cheap things to name; residual state has no natural owner in that style of test, which is where this class of bug lives.
The repair moves the checkpoint rather than the check: the record is written as soon as the video ID comes back, carrying `verified: false`, and gets promoted to `verified: true` if the follow-up query agrees [13]. That shortens the unrecorded window from "the whole verification round trip" to "the gap between receiving an ID and writing a small JSON file" [2], and it gives the guard something better than a boolean, with `--force` for a deliberate second copy and a `verified: false` record meaning resume verification against the ID already on disk [14]. The account does not say how the five earlier videos acquire records [15], and until they do, the new three-branch guard is still reading an incomplete ledger.
Ranked by verification strength, evidence, and original report placement.
Before the upload stage existed, five episodes had already been published through a different path, an MCP tool, which never wrote upload.json either.
A single run of the new command pointed at any of those five videos would have found no record, seen no reason to stop, and put a duplicate on the channel.
The published account does not state how records are created for the five videos already uploaded through the MCP path.
The YouTube upload stage ran four dependent steps: start a resumable session, PUT the file, get back a video ID, verify the upload landed as intended, then write a local record marking the episode as uploaded.
Verification means re-querying the video through videos.list after the upload finishes, to confirm visibility was not silently demoted, the upload was not rejected, and metadata propagated.
YouTube's upload API can report success at the transport layer while platform-side processing does something the caller did not ask for.
Follow any of these and your For You feed starts watching them — no settings page required.
Evidence-backed comparisons of source perspectives and observed adoption signals. Read the methodology
Which Builder, Operator, and Investor concerns the observed source mix emphasized—not a truth score.
Evidence, demonstrated adoption, hype gap, incentives, and confidence are assessed independently, each on its own current evidence. How these are measured.
Detailed but unverifiable single-author account
The account is specific and internally coherent at code level — named failure path, named guard, named test set, exact ordering of the fix — but it is one self-published postmortem with no repository, commit, log, or API artifact, and no second publisher or independent reviewer. The technical mechanism it describes (a side effect committed remotely before it is recorded locally) is a well-established class of bug, which raises plausibility without corroborating this particular instance.
One private pipeline, no external users
The only observed use is the author's own unnamed video pipeline: the reordered checkpoint was shipped there and records were backfilled for five episodes published through an MCP tool. No other project, team, product, or library is reported to have adopted the pattern, and the repository and tooling are unnamed, so breadth cannot be scored higher than a single self-reported deployment.
Restrained, with one unsupported generalization
The article does not oversell: it calls the guard's logic fine, admits the docstring was merely scoped narrower than it read, and concedes the backfill only worked because platform state was recoverable. The small positive gap comes from extending a five-video hobby-pipeline anecdote to payment authorization and cloud instance provisioning without evidence from those domains, and from framing the fix as closing the window when it shrinks it to the interval between receiving the ID and writing the file.
Low commercial stake, reputational upside
No vendor, sponsor, funding, or product being sold appears anywhere in the source; the author critiques their own code and discloses a defect they created, which cuts against promotional framing. Residual incentive is the ordinary one for a self-published engineering postmortem on a developer platform: professional visibility for the author's notes, and freedom to describe the repository, MCP tool, and test suite favourably since none can be inspected.
Plausible mechanism, thin corroboration
Confidence is moderate-low: the claims are consistent, the failure mode is a recognised class, and incentives to distort are limited, but everything rests on one unverifiable first-person account of an unnamed private project with no external adoption. One ledger entry also conflicted with the article body over whether the MCP-path remediation was described, resolved in favour of the body, which is a reminder that the record here is thin enough for detail-level drift.
build
Rate limit your MCP servers, because a retrying agent turns one error into a billing incident1 distinct publisher
build
Thirty minutes a day, and none of it from letting the agent write Swift1 distinct publisher
build
The MCP transport your search results teach has been deprecated since March1 distinct publisher
build
Sixty green checks, four shipped defects, and a scan that never printed its denominator1 distinct publisher
Distinct publishers with included, body-backed reporting in this cluster.
dev.to
1 article · August 24, 2026