paperclipai/paperclip · error · GitHubWebhookRecoveryError
github_webhook_recovery_invalid_input
github_webhook_recovery_invalid_input
Error message
github_webhook_recovery_invalid_input
What it means
inputId() validates caller-supplied identifiers (delivery IDs, comment IDs, installation IDs) by delegating to decimalId() and rethrowing failures as github_webhook_recovery_invalid_input. This means the problem is in YOUR input, not GitHub's response: the ID must be a decimal string of 1–20 digits with no leading zeros and within uint64 range.
Source
Thrown at server/src/services/chat-github-webhook-config.ts:114
invalidResponse();
return value as Record<string, unknown>;
}
function decimalId(value: unknown): string {
if (
typeof value !== "string" ||
!/^[1-9][0-9]{0,19}$/.test(value) ||
(value.length === 20 && value > "18446744073709551615")
)
invalidResponse();
return value;
}
function inputId(value: unknown): string {
try {
return decimalId(value);
} catch {
throw new GitHubWebhookRecoveryError(
"github_webhook_recovery_invalid_input",
);
}
}
function optionalId(value: unknown): string | null {
return value === undefined || value === null ? null : decimalId(value);
}
function timestamp(value: unknown): string {
if (
typeof value !== "string" ||
!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.\d{1,3})?Z$/.test(value) ||
!Number.isFinite(Date.parse(value))
)
invalidResponse();
const normalized = value.replace(
/(?:\.(\d{1,3}))?Z$/,View on GitHub (pinned to 01ad858492)
Solutions
- Coerce to a decimal string first: String(deliveryId) — but only if the source never had leading zeros or precision loss.
- Keep GitHub IDs as strings end-to-end (DB column type text/varchar, API fields as string) to avoid Number precision loss.
- Validate before calling: if (!/^[1-9][0-9]{0,19}$/.test(id)) reject early with a 400-style error.
- Check where the ID originated; if it came from this library's own deliveries list, it is already valid — the corruption happened in your storage layer.
Example fix
// before
const detail = await getGitHubAppWebhookDelivery({ fetch, appToken, deliveryId: row.id }); // row.id is a number
// after
const deliveryId = String(row.id);
if (!/^[1-9][0-9]{0,19}$/.test(deliveryId)) throw new Error("bad delivery id");
const detail = await getGitHubAppWebhookDelivery({ fetch, appToken, deliveryId }); Defensive patterns
Strategy: validation
Validate before calling
function isValidGitHubId(v: unknown): v is string {
return typeof v === "string" && /^[1-9][0-9]{0,19}$/.test(v) && !(v.length === 20 && v > "18446744073709551615");
} Type guard
function isValidGitHubId(v: unknown): v is string {
return typeof v === "string" && /^[1-9][0-9]{0,19}$/.test(v);
} Try / catch
try {
await getGitHubAppWebhookDelivery({ fetch, appToken, deliveryId });
} catch (e) {
if (e instanceof GitHubWebhookRecoveryError && e.code === "github_webhook_recovery_invalid_input") {
throw new BadRequest(`deliveryId must be a decimal string: ${typeof deliveryId}`);
}
throw e;
} Prevention
- Always keep GitHub IDs as strings end-to-end (DB text columns, JSON string fields)
- Coerce with String(id) at the boundary, then validate with the decimal regex
- Never strip or add leading zeros when persisting IDs
When it happens
Trigger: Calling getGitHubAppWebhookDelivery({deliveryId}), requestGitHubAppWebhookRedelivery({deliveryId}), or getGitHubRecoveryComment({commentId|installationId}) with a value that is not a string matching /^[1-9][0-9]{0,19}$/ — e.g. a number, null, undefined, an empty string, a zero-padded ID like "007", or a value exceeding 18446744073709551615.
Common situations: Passing a numeric delivery ID straight from JSON without String() conversion; storing IDs in a DB column that stripped leading zeros or coerced to number and lost precision; concatenating prefixes like "delivery_123"; receiving undefined because an upstream route param was optional.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- device-login promotion: the account identifier cannot form a
- Unsafe ${label}: ${result}
- ACPX provider package name is invalid: ${packageName}
- Invalid normalized OpenCode session id
- Invalid Discord command owner identifier
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10).
Data as JSON: /api/errors/d6cdbae75efee7f8.
Report an issue: GitHub.