{"record":{"id":"4694c99e175b5134","repo":"can1357/oh-my-pi","slug":"unknown-delivery-target","errorCode":null,"errorMessage":"unknown delivery {target}","messagePattern":"unknown delivery (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"python/robomp/src/server.py","lineNumber":659,"sourceCode":"        if isinstance(delivery_id, str) and delivery_id:\n            target = delivery_id\n        elif isinstance(issue_ref, str) and issue_ref:\n            try:\n                repo_full, number = parse_issue_ref(issue_ref)\n            except InvalidIssueRef as exc:\n                raise HTTPException(400, str(exc)) from exc\n            if not cfg.allows(repo_full):\n                raise HTTPException(403, f\"{repo_full} not in ROBOMP_REPO_ALLOWLIST\")\n            row = db.latest_event_for_issue(make_issue_key(repo_full, number))\n            if row is None:\n                raise HTTPException(404, f\"no retryable stored event for {repo_full}#{number}\")\n            target = row.delivery_id\n        else:\n            raise HTTPException(400, \"retry requires 'delivery_id' or 'issue'\")\n\n        event = db.get_event(target)\n        if event is None:\n            raise HTTPException(404, f\"unknown delivery {target}\")\n        if not db.requeue_event(target, from_states=INACTIVE_EVENT_STATES):\n            raise HTTPException(409, f\"delivery {target} is {event.state}; only inactive events can be retried\")\n        pool.wake()\n        log.info(\"manual retry\", extra={\"delivery\": target})\n        return JSONResponse(\n            {\"delivery\": target, \"state\": \"queued\", \"mode\": \"retry\"},\n            status_code=202,\n        )\n\n    @app.post(\"/api/cancel\")\n    async def api_cancel(\n        request: Request,\n        payload: dict[str, Any] = Body(...),\n        x_robomp_token: str | None = Header(None, alias=\"X-Robomp-Replay-Token\"),\n    ) -> JSONResponse:\n        \"\"\"Stop a running event. The omp subprocess is killed; the row lands in\n        `failed` with `cancelled by operator` as the error.\n        \"\"\"","sourceCodeStart":641,"sourceCodeEnd":677,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/python/robomp/src/server.py#L641-L677","documentation":"The retry endpoint looked up the supplied delivery_id in the database and found nothing, returning HTTP 404 'unknown delivery <target>'. Unlike error 4025 (issue-based lookup found no stored event), this fires on the direct path: `db.get_event(target)` returned None for the delivery id you passed. The id is well-formed but no event with it exists in this server's store.","triggerScenarios":"POSTing to the retry endpoint with `delivery_id` that does not exist in the database — ids from a different environment (staging vs prod), events deleted by retention/cleanup, ids truncated or mangled by the client, or webhooks that failed before being persisted.","commonSituations":"Copy-pasting a delivery id from the wrong robomp instance; re-running an old script after the database was wiped; a load balancer sent the original webhook to a different instance than the one you're retrying against; storage backend switched (e.g. new DB file) losing prior events.","solutions":["Verify the delivery_id against the target server's event store/logs — confirm you are querying the same instance","If you only know the issue, retry via `issue: \"owner/repo#N\"` so the server resolves the latest stored event","Check whether events were purged by retention and re-trigger fresh triage if the event is gone for good","Confirm you are not mixing staging and production delivery ids"],"exampleFix":"// before: id copied from another environment\nawait retry({ delivery_id: 'staging-uuid-123' });\n// after: resolve from the live event store\nconst evt = await api.getLatestEventForIssue('acme/widgets#42');\nawait retry({ delivery_id: evt.deliveryId });","handlingStrategy":"validation","validationCode":"// Resolve the id from the target server's own event store before retrying\nconst evt = await api.getLatestEventForIssue('acme/widgets#42');\nif (!evt) throw new Error('unknown delivery: resolve an existing deliveryId from this instance first');\nawait api.retry({ delivery_id: evt.deliveryId });","typeGuard":"function isNonEmptyString(v: unknown): v is string {\n  return typeof v === 'string' && v.length > 0;\n}","tryCatchPattern":"try {\n  await api.retry({ delivery_id: id });\n} catch (err) {\n  if (err.status === 404 && /unknown delivery/.test(err.message)) {\n    logger.error('delivery not in this server\\'s store — wrong instance or purged event', { id });\n  } else throw err;\n}","preventionTips":["Never reuse delivery ids across staging/production instances","Copy ids from the same server's logs or events API that will process the retry","Record delivery ids durably at webhook time if you plan to retry later","Understand retention: purged events cannot be retried by id"],"tags":["http-404","not-found","delivery-id","retry","api"],"backgroundTag":"resource-not-found","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}