# CLI 0.18.0: getpeppr send can be retried after an outage without sending twice

> @getpeppr/cli 0.18.0 sends every invoice with an Idempotency-Key and, when a send fails but may have gone through, prints the exact command that resends the same invoice under the same key. 0.17.3 told you to run the same command again, which could deliver the invoice twice.

- Published: 2026-12-01
- Language: English (en)
- Page: https://getpeppr.dev/news/2026-12-01-cli-0-18-0-safe-resend/
- Publisher: getpeppr (Zero Loop Labs Ltd)

When the Peppol provider is unavailable, the getpeppr API answers
`502 provider.unavailable` and asks you to retry with the **same**
`Idempotency-Key` and the **same** request body: a new key, or no key, may
send the invoice twice ([Error handling](/docs/error-handling/)).

`getpeppr send` 0.17.3 sent no key, and after that 502 it printed
`Next  Retry the same command.` Without a file, `send` builds a new invoice
number on every run, so following that advice after an outage that had in
fact reached the provider could deliver a second invoice. Measured against a
local stub that answers this 502: one `POST`, no key, no retry.

0.18.0 changes three things.

- **Every send carries a key.** A new `cli-<uuid>` for each run, or the one you
  pass with `--idempotency-key` (printable ASCII). Under the same API key,
  getpeppr never sends the same invoice twice under one key, so the bundled
  SDK now retries a retryable failure on its own: against the same stub, four
  attempts, one key, byte-identical bodies.
- **A failure that may have gone through prints a `Resend` line.** That is any
  failure except a final refusal (a `4xx` other than `408` and `429` that the
  API does not mark retryable) and an invoice the SDK refuses before sending.
  The line is the command to run later, as printed:

  ```text
  ✗ getpeppr API error (502): The Peppol provider is temporarily unavailable, so this invoice was not confirmed as sent. …
    Code     provider.unavailable
    Next     The invoice may already be sent. Retry later with the command below: it reuses the same API key, Idempotency-Key and invoice, which getpeppr never sends twice.
    Resend   getpeppr send /home/me/invoices/getpeppr-send-2ac62ed6-8eda7d7b.json --api-key-check 3a1cf26c0101 --idempotency-key cli-6f044895-0abe-4e47-8abe-31c7aee19d89
  ```

  The invoice that was sent is saved first, with a file or without, and the
  command resends that copy by its absolute path: editing your file, or
  running the command from another directory, does not change what it sends.
  `--api-key-check` carries a fingerprint of your API key, never the key: if
  another key would send it, the command exits `2` and sends nothing. If no
  copy can be saved, an `Options` line gives the options to resend the same
  invoice under. The invoice itself is never printed.
- **The output reaches the end.** `send` now exits only once stderr has taken
  its whole failure output. A long API message (a proxy's HTML error page)
  written to a pipe that was not read yet was lost entirely when the CLI
  exited right after writing, as 0.17.3 does; with 0.18.0 the `Resend` line
  arrives (measured with a 150 KB message, on Linux and macOS).

Measured on the getpeppr sandbox with the 0.18.0 candidate builds, to the test receiver
`9925:BE0314595348`: the same invoice sent twice under one key gave one
document, delivered; another invoice under that key was refused with
`422 idempotency.key_reused`.

`validate`, `convert`, `lookup` and the other commands are unchanged. The CLI
still bundles `@getpeppr/sdk` 6.8.3. All details are in the
[CLI documentation](/docs/cli/#send-command).

```bash
npm install -g @getpeppr/cli@0.18.0
```
