All courses

Invented APIs, flags, config keys and packages

Recognise idiomatic-looking calls to methods, CLI flags, config options or packages that do not exist or belong to a different version: removed APIs, old import paths, options the installed version lacks. Check cheaply that each one exists, using the compiler, the docs, `--help` or the registry.

Builds on: Training cutoff and API drift

Read it card by card Start the whole course

Idiomatic, confident and not real

You asked the agent to add a 5-second timeout to the call that posts orders to a payment service. The diff adds `timeout: 5000` to the `fetch` options. It reads naturally, the agent reports "Added a 5s timeout", and the tests are green. None of the tests talk to a slow server. Does this code actually have a timeout?

Why invented names look so right

The agent writes what is most likely given its context. Any of these looks as likely as a real name: one from a sibling library (axios has `timeout`), one from an older version, or one that just fits the naming pattern. Its sure tone doesn't flag it. Compilers reject unknown methods. Python and JS fail only when that line runs. Options objects, kwargs and config files may ignore unknown keys silently. **Later cost:** a timeout, limit or safety setting that never applies.

Check each unfamiliar name where it lives

**Tells:** a name you know from another library or tool, an option passed in a free-form object, kwargs or config file, or a call on a path no test runs. **Cheap checks against the installed version:** - Method or import: the project's own build or type check, so its pinned versions apply: `cargo check`, `go build`, `tsc --noEmit`, `mypy`, the Maven build for Java. In Python, import and call it. - CLI flag: `tool --help`. - Config key: that version's docs or schema. - Package: the registry (`npm view`, pypi.org, crates.io, pkg.go.dev), before installing. Someone else may already have registered an invented name, and installing it can run their code.

fetch has no timeout option

Standard `fetch` has no `timeout` key. The agent most likely borrowed it from axios or node-fetch v2. In plain JS the unknown key is ignored, so there is no error and no 5-second timeout. A stalled server keeps the request waiting as long as the runtime's own defaults allow, which is minutes in Node. TypeScript flags it only because the options are an inline object literal (excess property check). The real mechanism is an abort signal. `AbortSignal.timeout(5000)` (Node 18+, current browsers) rejects the call with a `TimeoutError`.
// JavaScript
// BAD
const res = await fetch(url, {
  method: "POST",
  timeout: 5000,
});
// BETTER
const res = await fetch(url, {
  method: "POST",
  signal: AbortSignal.timeout(5000),
});

A removed method on a rare path

After a pandas upgrade, the agent edits an export job. In the branch for late orders it writes `df = df.append(row, ignore_index=True)`. The tests pass because none of them hit that branch. `DataFrame.append` was removed in pandas 2.0, so the job raises `AttributeError` on the first late order. A ten-second check: `$ python -c "import pandas as pd; print(pd.__version__, hasattr(pd.DataFrame, 'append'))"` prints `2.2.2 False`. BETTER: `pd.concat([df, pd.DataFrame([row])], ignore_index=True)`.

Every name is a guess until checked

Each method, flag, config key and package the agent names is a guess until something checks it against your installed version: the compiler, `--help`, the versioned docs or the registry. Be most suspicious where nothing would complain: Python and JS lines no test runs, options objects, kwargs and config files.

On Bytewise this lesson comes in small steps with a check at the end, and the app brings it back right before you would forget it.