[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-108607":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":24,"createdAt":10,"pushedAt":34,"updatedAt":35,"readmeContent":36,"aiSummary":37,"trendingCount":15,"starSnapshotCount":15,"syncStatus":38,"lastSyncTime":39,"discoverSource":40},108607,"bicho","bicho-fyi\u002Fbicho","bicho-fyi","Self-hosted error tracking on Cloudflare Workers, with OTLP ingestion and MCP tools for investigating errors.","https:\u002F\u002Fbicho.fyi",null,"JavaScript",213,210,56,0,1,30,152,3,73.97,"Apache License 2.0",false,"main",[25,26,27,28,29,30,31,32,33],"cloudflare-d1","cloudflare-r2","cloudflare-workers","error-tracking","mcp","opentelemetry","otlp","self-hosted","typescript","2026-11-06 16:24:40","2026-11-22 15:57:15","# Bicho\n\n[![Source version](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fpackage-json\u002Fv\u002Fbicho-fyi\u002Fbicho)](package.json)\n[![Cloudflare Workers](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FCloudflare-Workers-F38020?logo=cloudflare&logoColor=white)](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002F)\n[![TypeScript](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTypeScript-3178C6?logo=typescript&logoColor=white)](https:\u002F\u002Fwww.typescriptlang.org\u002F)\n[![Node.js 24](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FNode.js-24-5FA04E?logo=nodedotjs&logoColor=white)](package.json)\n[![License](https:\u002F\u002Fimg.shields.io\u002Fbadge\u002Flicense-Apache--2.0-green)](LICENSE)\n\nBicho is a self-hosted error tracker on Cloudflare Workers. Send exception and error logs over OTLP\u002FHTTP or from Sentry SDKs, inspect grouped issues through the API or MCP, and keep the captured evidence in your own D1 database and R2 bucket.\n\nIt accepts OTLP JSON and binary protobuf logs, plus Sentry error envelopes and legacy store requests. You can use it without a dashboard or an OpenTelemetry Collector.\n\n## SDKs\n\n| SDK or integration | Package | Capture and delivery |\n| --- | --- | --- |\n| [JavaScript \u002F TypeScript](https:\u002F\u002Fgithub.com\u002Fbicho-fyi\u002Fbicho-javascript) | [`@bicho-fyi\u002Fjavascript`](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@bicho-fyi\u002Fjavascript) | Automatic browser capture and explicit Node.js reporting; queued delivery with flush\u002Fclose. |\n| [PHP](https:\u002F\u002Fgithub.com\u002Fbicho-fyi\u002Fbicho-php) | [`bicho-fyi\u002Fphp`](https:\u002F\u002Fpackagist.org\u002Fpackages\u002Fbicho-fyi\u002Fphp) | Explicit capture with synchronous delivery; PHP 8.2+. |\n| [Rust](https:\u002F\u002Fgithub.com\u002Fbicho-fyi\u002Fbicho-rust) | [`bicho`](https:\u002F\u002Fcrates.io\u002Fcrates\u002Fbicho) | Explicit, awaited delivery on Tokio, including the Rust side of Tauri apps. |\n| [Python](https:\u002F\u002Fgithub.com\u002Fbicho-fyi\u002Fbicho-python) | `bicho-fyi` ([install from Git](https:\u002F\u002Fbicho.fyi\u002Fdocs\u002Fpython\u002F#install-from-git)) | Explicit capture with synchronous delivery; Python 3.11+. |\n| [Astro](https:\u002F\u002Fgithub.com\u002Fbicho-fyi\u002Fbicho-astro) | [`@bicho-fyi\u002Fastro`](https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002F@bicho-fyi\u002Fastro) | Opt-in browser capture and server request-exception reporting with separate project settings. |\n| [WordPress](https:\u002F\u002Fgithub.com\u002Fbicho-fyi\u002Fbicho-wordpress) | [`bicho-error-tracking.zip`](https:\u002F\u002Fgithub.com\u002Fbicho-fyi\u002Fbicho-wordpress\u002Freleases\u002Ftag\u002Fv1.0.0) | Opt-in PHP warning\u002Ffatal reporting and frontend browser capture with independent settings. |\n\nSee the [SDK guides](https:\u002F\u002Fbicho.fyi\u002Fdocs\u002Fsdks\u002F) and [runnable examples](https:\u002F\u002Fgithub.com\u002Fbicho-fyi\u002Fbicho-examples) for setup and delivery behavior.\n\nYou can also [keep an existing Sentry SDK and replace its DSN](https:\u002F\u002Fbicho.fyi\u002Fdocs\u002Fsentry\u002F). For other integrations, use an OpenTelemetry logs exporter with OTLP\u002FHTTP JSON or protobuf.\n\n## Deploy to Cloudflare\n\n[![Deploy to Cloudflare](https:\u002F\u002Fdeploy.workers.cloudflare.com\u002Fbutton)](https:\u002F\u002Fdeploy.workers.cloudflare.com\u002F?url=https:\u002F\u002Fgithub.com\u002Fbicho-fyi\u002Fbicho)\n\nThe button copies the public repository into your account, provisions D1 and R2, and sets up Workers Builds. Enable R2 in your Cloudflare account first. When prompted for `BICHO_ADMIN_TOKEN`, supply a unique token generated with `openssl rand -hex 32`. Save it for API and MCP access.\n\nThe deploy script applies database migrations before deploying the Worker. Your instance is available at its `workers.dev` URL; preview URLs are disabled.\n\nAfter deployment:\n\n1. Connect your MCP client to `https:\u002F\u002F\u003Cyour-worker>\u002Fmcp` using the admin bearer token.\n2. Call `create_project` with `{ \"name\": \"My app\" }`. It creates the database record and returns a generated project ID, OTLP configuration and Sentry DSN. No local SQL or direct database access is needed.\n3. Save the returned headers and configure your application's exporter or SDK. Use `secret: true` only for backend projects.\n\nFor a custom domain, configure the route and disable `workers_dev` when you no longer need that alternate endpoint. See [Cloudflare's deploy-button documentation](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fworkers\u002Fplatform\u002Fdeploy-buttons\u002F) for platform setup details.\n\nThis package contains the Worker source, not a browser SDK or a standalone Node server. Installing it from npm does not create Cloudflare resources; use the deployment flow above to host an instance.\n\n## Local setup\n\nUse Node 24 and npm. The Worker needs the `DB` (D1) and `PAYLOADS` (R2) bindings in `wrangler.jsonc`. Local development uses local storage; replace the placeholder D1 ID before deploying to an existing Cloudflare database.\n\nFor local development, copy `.dev.vars.example` to `.dev.vars` and set `BICHO_ADMIN_TOKEN` to a long random token. Use a Cloudflare secret for hosted instances. Never put the token in D1, frontend code or `wrangler.jsonc`. Admin endpoints return 503 if it is missing or empty.\n\n```sh\nnvm use\nnpm ci\nnpm run check\nnpm test\nnpx wrangler d1 migrations apply DB --local\nnpm run dev\n```\n\nRegister a project through MCP at `http:\u002F\u002Flocalhost:8787\u002Fmcp`, or use `POST \u002Fapi\u002Fprojects`, with your local admin token.\n\nFor offline SQL generation, run `npm run project -- 1 \"My app\" http:\u002F\u002Flocalhost:8787`. It writes SQL and ingest credentials under ignored `_temp\u002F` without connecting to Cloudflare. Apply `_temp\u002Fproject-1.sql` to the local database before using the generated `otlp.endpoint` and `otlp.headers`.\n\n[project.example.json](project.example.json) and [project.example.sql](project.example.sql) show the generated formats with placeholder credentials. The JSON is not an importable configuration, and editing it does not register a project. Generate your own credentials rather than using the placeholders.\n\nBrowser projects use a public ingest key without a secret. `--secret` requires an additional ingest secret for backend clients. Generated OTLP headers contain `X-Bicho-Key` and, when required, `X-Bicho-Secret`. A secret never grants admin access. Do not put it in a browser bundle.\n\n### Manual hosted setup\n\n1. Provision a fresh D1 database and private R2 bucket. The default names in `wrangler.jsonc` are `bicho` for the Worker and database, and `bicho-events` for the bucket. Replace the all-zero D1 ID with your database ID and adjust names as needed, retaining the `DB`\u002F`PAYLOADS` binding names and `nodejs_compat`. The migration command uses the `DB` binding so you can choose a different database name.\n2. Keep `migrations_dir` pointed at `migrations`. The deploy script applies `migrations\u002F0001_core.sql` to the database.\n3. Configure `BICHO_ADMIN_TOKEN` as a Worker secret. Set `CORS_ORIGINS` only for trusted browser origins; dashboards should keep the admin credential on their server rather than ship it in a public bundle.\n4. Deploy through Workers Builds or your CI\u002FCD with `npm run deploy`. Use the `workers.dev` URL or configure a custom domain and disable `workers_dev`. Check that the hourly Cron Trigger is attached.\n5. Register a project through MCP or the API on the hosted instance. Local project records are separate from the hosted database.\n\nThe initial migration is for a fresh database. Editing it does not upgrade a database where it has already run. Never reset populated storage to reapply it.\n\n## Register a project\n\nOn a running local or hosted Worker, call MCP `create_project` with `{ \"name\": \"My app\" }`, or send the same JSON to `POST \u002Fapi\u002Fprojects` with the admin bearer token. The optional `hourly_limit` accepts an integer from 1 to 1000000 (default 1000). Set `secret: true` to require an additional backend ingest secret.\n\nThe API returns HTTP 201 with `{ project: { id, name, hourly_limit }, otlp: { endpoint, headers }, sentry: { dsn, headers? } }`. The server generates a unique numeric-string ID and random ingest credentials. Save the returned headers securely: project listings do not expose credentials, and only the ingest secret's hash is stored. IDs cannot be supplied, and registration never replaces or deletes existing projects. Each call creates a new project, even with the same name; check `list_projects` before retrying after a lost response.\n\nTo recover an existing project's configuration instead of registering another, call MCP `get_project` or `GET \u002Fapi\u002Fprojects\u002F\u003Cproject-id>` with the admin bearer token. It returns the same `project`, `otlp` and `sentry` values plus `secret_required`. Only the public ingest key is recoverable; a project created with `secret: true` still needs its secret, which is stored as a hash and cannot be read back.\n\n## Move from Sentry\n\nCreate a Bicho project through MCP or the API and use its returned `sentry.dsn` in your existing Sentry SDK configuration. You keep your application's error-capture code; Bicho receives and groups the events.\n\nFor JavaScript, using your existing `@sentry\u002Fbrowser` or `@sentry\u002Fnode` import:\n\n```js\nSentry.init({\n  dsn: \"https:\u002F\u002FYOUR_PUBLIC_KEY@your-bicho-worker.example\u002FPROJECT_ID\",\n  tracesSampleRate: 0,\n  sendClientReports: false,\n});\n```\n\nUse the generated DSN rather than the placeholder above. Keep error-capture integrations; remove integrations that send replay, profiling, tracing or structured logs. Bicho stores error\u002Fmessage events, not those other data types. Release, environment, tags, custom fingerprints, stack frames, breadcrumbs and contexts remain available through the same API and MCP tools as OTLP events. This changes where new errors go; it does not import historical Sentry data or reproduce Sentry's grouping rules.\n\nFor a secret-enabled backend project, pass the generated `sentry.headers` using the SDK's transport headers. With `@sentry\u002Fnode`:\n\n```js\nSentry.init({\n  dsn: project.sentry.dsn,\n  transportOptions: { headers: project.sentry.headers },\n  tracesSampleRate: 0,\n  sendClientReports: false,\n});\n```\n\nBrowser projects must not require an ingest secret. Keep the admin token out of SDK configuration. For SDKs without custom-header support, use a public-key-only project or a transport that supplies the required backend secret; a DSN alone cannot bypass it.\n\nBicho accepts `POST \u002Fapi\u002F:project_id\u002Fenvelope\u002F` and raw JSON at the legacy `POST \u002Fapi\u002F:project_id\u002Fstore\u002F` endpoint. Query authentication (`sentry_version=7&sentry_key=...`), `X-Sentry-Auth`, and self-authenticating envelope DSNs are supported. Supplied credentials must agree with each other and the project. Envelope DSNs must use this installation's origin. Authentication never forwards requests to Sentry.\n\nRequests support gzip and deflate compression via `Content-Encoding`. They are limited to 2 MiB on the wire and after decompression, 1 MiB per error event, 100 envelope items, 32 JSON nesting levels and 20,000 structural values per parsed object. Brotli, zstd, base64-wrapped legacy payloads, minidumps and Sentry artifact-bundle uploads are not supported. Upload source maps through Bicho's authenticated map API; captured frames or `debug_meta.images` must supply matching debug IDs.\n\nSuccessful responses include `accepted`, `rejected` and `discarded`. Unsupported item types, including attachments and sessions, are skipped and counted in `discarded`; their payloads are not stored. Malformed error events reject the batch before persistence. Quota rejection before acceptance returns 429 with `Retry-After` and `X-Sentry-Rate-Limits`; a storage failure returns 503. After an accepted prefix, Bicho returns 200 and lists rejected IDs so clients do not replay the accepted batch. Standard SDKs may ignore that body and drop the rejected remainder. When explicitly resending individual events, keep their `event_id`; retries deduplicate within a project.\n\nInteroperability tests exercise `@sentry\u002Fnode` and `@sentry\u002Fbrowser` 11.8.0 serialization and transports, including real HTTP delivery, plus browser-client delivery inside workerd. Compatibility with another SDK depends on its transport and emitted event format.\n\n## OpenTelemetry ingestion\n\nConfigure a logs exporter for your application language. With exporters that honor the standard environment variables:\n\n```sh\nexport OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https:\u002F\u002Fyour-bicho-worker.example\u002Fv1\u002Flogs\nexport OTEL_EXPORTER_OTLP_LOGS_PROTOCOL=http\u002Fprotobuf\nexport OTEL_EXPORTER_OTLP_LOGS_HEADERS=X-Bicho-Key=YOUR_PUBLIC_KEY\n```\n\nFor a project provisioned with `--secret`, include both headers:\n\n```sh\nexport OTEL_EXPORTER_OTLP_LOGS_HEADERS=\"X-Bicho-Key=YOUR_PUBLIC_KEY,X-Bicho-Secret=YOUR_INGEST_SECRET\"\n```\n\nUse the generated `otlp` object, not these placeholder keys. `http\u002Fjson` is also supported where the exporter implements it. Use the logs-specific endpoint above so it is used as-is; a generic OTLP base endpoint normally has `\u002Fv1\u002Flogs` appended by the exporter. Bicho does not accept gRPC, `\u002Fv1\u002Ftraces` or `\u002Fv1\u002Fmetrics`.\n\nInstall an OpenTelemetry logs SDK, exporter or logging bridge for your application language. Environment variables configure the exporter; your instrumentation must capture exceptions and emit them as logs. Trace events alone are not enough.\n\n`POST \u002Fv1\u002Flogs` identifies the project from `X-Bicho-Key`. `service.name` and other resource attributes are metadata, never authentication. Browser keys are public and ingest-only; backend projects may also require `X-Bicho-Secret`. Neither grants read, state-change, map-upload or MCP access. Cross-origin ingestion supports preflight; read\u002Fadmin CORS remains separate.\n\nThe payload must follow OTLP's protobuf JSON mapping or binary protobuf schema. Exceptions use `exception.type`, `exception.message` and `exception.stacktrace` attributes. Bicho accepts exception records regardless of severity, plus plain ERROR\u002FFATAL logs; it rejects other records through partial-success responses rather than acting as a general log archive.\n\nFull success returns HTTP 200 with an empty export response (`{}` for JSON). Partial acceptance returns HTTP 200 with `partialSuccess.rejectedLogRecords` and a diagnostic message. Exporters must not retry a populated partial-success response. A whole-request failure uses the OTLP status shape and the request encoding, not the REST read API's `{error}` shape. Quotas\u002Fstorage failures can return 429\u002F503 before any accepted records; respect `Retry-After`.\n\nFor retry-safe occurrence counts, provide a stable `log.record.uid` attribute for each emitted record and preserve it across retries. Bicho derives a project-scoped event ID from that UID. Without one, Bicho generates an ID and a resent batch can count as new occurrences; trace\u002Fspan correlation IDs are not deduplication keys. Equal error messages still group into the same issue but represent separate occurrences.\n\nBicho preserves sanitized resources, instrumentation scopes, timestamp precision and raw stack text. The search index uses millisecond timestamps. Recognized stack formats also produce frames for grouping; other formats remain readable as text. Source-map enrichment needs matching debug IDs, which ordinary OTLP stack attributes do not supply.\n\nRequests are limited to 2 MiB on the wire and after decompression, 100 records per batch, 32 nesting levels and 20,000 structural values. A normalized record is limited to 1 MiB. Invalid known fields reject the batch before storage; ordinary low-severity logs use partial rejection. Derived stacks stop at 200 input lines or 100 recognized frames; the sanitized raw stack remains available.\n\nThe bundled OTLP schemas and their upstream licenses are documented in [src\u002Fvendor\u002Fotlp](src\u002Fvendor\u002Fotlp\u002FREADME.md).\n\n### Send a JSON record\n\nUse a dedicated test project for this example and replace the endpoint and key with its generated values. The fixed occurrence UID lets you resend the request to check deduplication without adding another event.\n\n```sh\ncurl --fail-with-body -sS https:\u002F\u002Fyour-bicho-worker.example\u002Fv1\u002Flogs \\\n  -H 'Content-Type: application\u002Fjson' \\\n  -H 'X-Bicho-Key: YOUR_PUBLIC_KEY' \\\n  --data-binary '{\"resourceLogs\":[{\"resource\":{\"attributes\":[{\"key\":\"service.name\",\"value\":{\"stringValue\":\"smoke-test\"}}]},\"scopeLogs\":[{\"logRecords\":[{\"severityNumber\":17,\"body\":{\"stringValue\":\"Smoke-test failure\"},\"attributes\":[{\"key\":\"exception.type\",\"value\":{\"stringValue\":\"TestError\"}},{\"key\":\"log.record.uid\",\"value\":{\"stringValue\":\"bicho-otlp-smoke-1\"}}]}]}]}]}'\n```\n\nVerify the stored event through authenticated issue\u002Fevent reads, not just HTTP success. Applications may send directly or through an OpenTelemetry Collector; a Collector is optional and is not bundled with Bicho. See the [OTLP specification](https:\u002F\u002Fopentelemetry.io\u002Fdocs\u002Fspecs\u002Fotlp\u002F) and [exception log conventions](https:\u002F\u002Fopentelemetry.io\u002Fdocs\u002Fspecs\u002Fsemconv\u002Fexceptions\u002Fexceptions-logs\u002F).\n\n## API contract and schemas\n\n[docs\u002Fopenapi.json](docs\u002Fopenapi.json) documents the HTTP routes, authentication, parameters and response shapes in OpenAPI 3.1.1 format. Import it into your API client and set your deployment hostname. The Worker does not host a documentation UI or serve this file.\n\nMCP tool input schemas use Zod in [src\u002Fmcp.ts](src\u002Fmcp.ts). An authenticated MCP client receives their JSON Schema through `tools\u002Flist`; no separate public schema route is needed. OpenAPI describes the `\u002Fmcp` transport, while Zod describes the individual tool arguments. OTLP ingest requires X-Bicho-Key and, for secret-enabled projects, X-Bicho-Secret.\n\nContract tests compare routes and responses with OpenAPI. The handlers also validate cross-field rules, including time ranges, cursor scope and source-map segments.\n\nTo validate the complete document independently, with Python's `uv` available:\n\n```sh\nuvx --from openapi-spec-validator openapi-spec-validator docs\u002Fopenapi.json\n```\n\n## Development\n\nRun `npm run check` and `npm test` before submitting changes. Vitest runs Node tests and local Workers-runtime tests with isolated D1\u002FR2 storage. Use `npm run test:node`, `npm run test:workers` or `npm run test:watch` for a narrower run. Tests do not load your `.dev.vars` or contact Cloudflare.\n\n`src\u002Findex.ts` owns Hono routes, authentication middleware, CORS, security headers, and HTTP errors. `src\u002Fcore.ts` owns ingestion, grouping, and storage queries. `src\u002Fotlp.ts` owns OTLP ingestion and mapping; `src\u002Fhttp.ts` supplies shared HTTP errors and JSON-object validation. Add routes beside the existing ones, reuse the project\u002Fadmin-auth middleware, and keep fallback handlers last. Keep every storage lookup project-scoped.\n\nGlobal headers apply to JSON, streamed R2 payloads, preflights, and errors: restrictive CSP, frame denial, permissions restrictions, MIME sniffing protection, referrer protection, and `no-store`. HTTPS responses receive HSTS for the current host only, without preload or subdomain enforcement. Each response includes a server-generated `X-Request-ID`; internal error logs use that ID and omit credentials, queries, and event bodies.\n\nFor a separate dashboard, set `CORS_ORIGINS` in `wrangler.jsonc`, for example `https:\u002F\u002Fdashboard.example.com,http:\u002F\u002Flocalhost:5173`. CORS is browser policy, not authorization. The API header policy assumes JSON-only responses; give future HTML routes their own CSP rather than weakening the global policy.\n\nSee [AGENTS.md](.\u002FAGENTS.md) for contributor guardrails. Ingest credentials never authorize reads or mutations, events are append-only, and MCP tools use the authenticated API.\n\n## HTTP API\n\nSend `Authorization: Bearer \u003CBICHO_ADMIN_TOKEN>` on every read, issue PATCH, source-map PUT and MCP request. The Worker compares SHA-256 digests constant-time; ingest keys and secrets are not admin credentials. REST responses are JSON; errors use `{ \"error\": \"...\" }`.\n\n- `GET \u002Fapi\u002F:project_id\u002Fissues`: `{ issues, has_more, next_offset, next_cursor, provenance }`\n- `GET \u002Fapi\u002F:project_id\u002Fissues\u002F:id`: `{ issue, events, has_more, next_offset, next_cursor, provenance }`\n- `GET \u002Fapi\u002F:project_id\u002Fevents\u002F:id`: full event JSON\n- `GET \u002Fapi\u002F:project_id\u002Freleases`: `{ releases, next_offset }`, derived from stored events\n- `GET \u002Fapi\u002Fprojects`: project IDs, names, and hourly quotas, without ingest credentials\n- `POST \u002Fapi\u002Fprojects`: register a project; returns its generated ID, OTLP credentials and Sentry DSN\n- `POST \u002Fapi\u002F:project_id\u002Fenvelope\u002F`: ingest Sentry error envelopes\n- `POST \u002Fapi\u002F:project_id\u002Fstore\u002F`: ingest legacy Sentry error JSON\n- `GET \u002Fapi\u002F:project_id\u002Fevents`: searchable event metadata\n- `GET \u002Fapi\u002F:project_id\u002Fissues\u002F:id\u002Fhistory`: recorded status transitions\n- `GET \u002Fapi\u002F:project_id\u002Fstats`: deterministic counts, UTC buckets, breakdowns, and representative event metadata\n- `GET \u002Fapi\u002F:project_id\u002Fprocessing`: project enrichment counts and explicitly global processor health\n- `PUT \u002Fapi\u002F:project_id\u002Fsourcemaps\u002F:debug_id`: register an immutable Source Map v3 JSON object\n- `GET \u002Fapi\u002F:project_id\u002Fsourcemaps\u002F:debug_id`: source-map metadata, not source contents or storage keys\n- `PATCH \u002Fapi\u002F:project_id\u002Fissues\u002F:id`: `{ \"status\": \"resolved\" }` returns `{ issue }`\n\nPATCH accepts only `status`: `resolved`, `ignored`, `muted`, or `unresolved` to reopen. It changes no events or payloads. New events do not automatically reopen hidden issues. There are no DELETE endpoints.\n\nActual status changes record history transactionally; repeated identical PATCH requests add nothing. History actor `admin` means the shared administrator credential, not a named individual.\n\nLists accept `limit` (1..100, default 50) and `offset` (0..1000000). Issue lists default to `status=unresolved`; another status or `status=all` includes hidden issues. They also accept `q`, `environment`, `release`, `level` and `issue_id`. Event\u002Fstatistics reads may filter the current issue status but do not default to unresolved. Filters match a stored event in the issue; `event_count` remains the all-time total. IDs and every lookup are scoped to the project. Issue IDs are lowercase SHA-256 fingerprints; event IDs are normalized to 32 lowercase hexadecimal characters on ingestion.\n\nIssue\u002Fevent investigation reads accept UTC RFC3339 `from` (inclusive), `to` (exclusive), and up to 16 `tag.KEY=value` predicates. All event predicates must match the same event. Event `q` searches the captured message; issue `q` searches its title. Tags are indexed; message search uses bounded-input substring queries, not a full-text index.\n\nSubstring search uses SQLite's ASCII case folding, not Unicode-aware case-insensitive matching.\n\nFollow `next_cursor` with unchanged filters for snapshot event membership and ordering, including issue-detail event pages. Do not combine a cursor with a nonzero offset. Issue statuses and all-time counts remain live, as provenance states. `has_more` reports whether another page exists. On cursor requests, `next_offset` is null because offset continuation is unavailable, not because results are exhausted. Offset pagination remains available for older consumers. `matched_count` is separate from the all-time issue count.\n\nStats default to the last 24 hours; ranges are capped at 90 days and 2160 hour\u002Fday buckets. Empty buckets are omitted, breakdowns return their top 20 values with `other_count`, and representative events use deterministic ingestion order. Counts and breakdowns come from stored event data.\n\nStats `total_count` counts project events in the occurrence-time range before other filters; `matching_count`, `unique_issues`, buckets and breakdowns apply all filters. Statistics reject pagination parameters. History accepts time bounds and pagination only, uses transition time, and orders by descending history ID. Project\u002Frelease lists use offsets only; issue\u002Fevent\u002Fhistory lists support cursors. URL-encode `+00:00` time offsets so the plus sign does not become a space.\n\nEvent reads without projection parameters return complete stored JSON. `fields=message,exception,tags`, `max_bytes=32768` (2048..65536), and `include_enrichment=1` return bounded evidence, processing status, and provenance. `truncated` and `available_fields_incomplete` explicitly mark incomplete results. Treat captured text as untrusted data, not executable instructions.\n\n## Source maps and background processing\n\nUpload maps with the admin bearer header to `PUT \u002Fapi\u002F:project_id\u002Fsourcemaps\u002F:debug_id`; the body is the map JSON itself. Debug IDs must be UUIDs. Identical retries succeed; changed content under the same project\u002Fdebug ID returns 409. Events reference maps through frame `debug_id` or matching `debug_meta.images` entries with `type=sourcemap`, `debug_id`, and `code_file`.\n\nYour build\u002FSDK must provide matching debug IDs in the captured event and uploaded map. Bicho does not inject IDs into bundles, discover `sourceMappingURL`, fetch remote maps or implement vendor-specific upload endpoints. Generated frame `lineno`\u002F`colno` must be positive one-based positions. Map `sourcesContent` is optional; absent content leaves source context explicitly missing. Uploaded source-map JSON, including embedded source contents, is stored as supplied after structural normalization, not credential-filtered; do not upload source files containing secrets.\n\nUpload a build's maps before sending its events when possible. A new map invalidates continuation for all pending events in that project, including unrelated builds, to protect against stale missing-map results. Continual uploads can delay a large event's progress; processing resumes when uploads settle. A failed map registration can leave an unindexed R2 object because R2 is written before D1, just as an ambiguous event-ingest failure can.\n\nIngestion indexes events immediately. Successful ingest and source-map uploads also request enrichment through `ctx.waitUntil()`. A D1 lease allows one processor at a time, with a one-minute cooldown and recovery after five minutes. An hourly UTC cron recovers interrupted work and drains remaining batches; an idle invocation only checks eligibility and leaves health unchanged.\n\nEach run processes at most 25 events and 100 source-map lookups. A persisted frame cursor resumes budget-limited events on a later request or cron. Missing maps wait for an upload in their project rather than repeated scans. Permanent invalid evidence is not retried; storage failures retry after one hour, up to three attempts. Source positions and bounded context live in separate derived objects. Original event bytes, fingerprints, and issue states are unchanged.\n\n`waitUntil()` is best-effort background work, not a durable queue. If a request arrives during the cooldown, no timer is armed for the next minute: the next eligible request or hourly cron continues it. With no traffic, a backlog advances by at most one batch per hour. The processing endpoint separates project status counts from global last-run health; `processed`\u002F`failed` count that run's attempts, not lifetime totals. `pending` can mean waiting for an upload or resumable work. Inspect event enrichment reasons and truncation flags, not just the global health boolean. Exhausted\u002Fpermanent failures remain visible and have no public retry\u002Freset endpoint.\n\nMaps are limited to 2 MiB decoded\u002Fwire JSON, 50,000 mapping segments, and 10,000 sources\u002Fnames. Processing caps at 1000 frames per event, five cached maps, and 256 characters per context line. Partial, missing, invalid, and truncated results are explicit. Indexed\u002Fsectioned maps, external map references, vendor-specific artifact bundles, and native crash symbolication are not supported. Source URLs are labels only; the Worker never fetches them.\n\nFor an operator-owned map file:\n\n```sh\ncurl --fail-with-body -sS -X PUT \\\n  -H \"Authorization: Bearer $BICHO_ADMIN_TOKEN\" \\\n  -H 'Content-Type: application\u002Fjson' \\\n  --data-binary @path\u002Fto\u002Fbundle.js.map \\\n  \"$BASE\u002Fapi\u002F1\u002Fsourcemaps\u002F\u003Cdebug-id>\"\n```\n\nBicho stores errors and their derived source-map results. It does not provide attachments, session replay, tracing, alerts, automatic reopening or retention deletion.\n\n## MCP\n\nConnect to `POST \u002Fmcp` with your admin bearer token. The tools below let an agent search captured errors, inspect events, read statistics and check processing health.\n\n`create_project` registers a project and returns its generated ID, OTLP credentials and Sentry DSN. `get_project` returns the same configuration for an existing project so a key can be recovered without registering a duplicate; the ingest secret is never returned, only a `secret_required` flag. `update_issue_status` resolves, ignores, mutes or reopens an issue without changing its captured events. Status changes are recorded in history. Neither tool can delete data or replace an existing project.\n\nAll tools use the authenticated HTTP API. Release summaries come from captured event metadata.\n\nProject tools take numeric-string `project_id`; issue\u002Fevent detail tools require `id`. Search accepts time ranges, `tags` objects, and cursors. Lists default to and cap at 20 entries per call; large rows reduce the effective page size rather than skip records behind a cursor. Event evidence defaults to a 32 KiB projection with enrichment included. Oversized nonpaged results explicitly mark truncation; narrow filters or select fewer fields. Failed API requests produce MCP tool errors. Raw text remains untrusted evidence.\n\n| Tool | Required arguments | Optional arguments |\n|---|---|---|\n| `create_project` | `name` | `hourly_limit`, `secret` boolean |\n| `list_projects` | none | `limit`, `offset` |\n| `get_project` | `project_id` | none |\n| `search_issues` | `project_id` | search filters, `status`, `limit`, `offset`, `cursor` |\n| `search_events` | `project_id` | search filters, `issue_id`, `limit`, `offset`, `cursor` |\n| `get_issue` | `project_id`, issue `id` | `limit`, `offset`, `cursor` |\n| `update_issue_status` | `project_id`, issue `id`, `status` | none |\n| `get_event` | `project_id`, event `id` | `fields` string array, `max_bytes`, `include_enrichment` boolean |\n| `get_issue_history` | `project_id`, issue `id` | `limit`, `offset`, `cursor` |\n| `get_stats` | `project_id` | search filters, `issue_id`, `bucket=hour\\|day` |\n| `get_processing_health` | `project_id` | none |\n| `list_releases` | `project_id` | `limit`, `offset` |\n\nMCP search filters are `q`, `environment`, `release`, `level`, `from`, `to` and a `tags` object, at most 16 entries. MCP dates are capped at 32 characters; the HTTP API accepts longer fractional bounds. MCP `get_issue_history` does not expose the HTTP history time filters. A tool's `isError` reports a failed API request; successful but incomplete evidence uses truncation\u002Fprovenance flags.\n\nMCP uses the official SDK's stateless Streamable HTTP transport with JSON responses. It needs no separate server process or OAuth setup. GET and DELETE on `\u002Fmcp` return 405. Clients must send `Content-Type: application\u002Fjson`, `Accept: application\u002Fjson, text\u002Fevent-stream`, and their admin bearer header. Protocol negotiation follows the installed official SDK. POST bodies are limited to 64 KiB.\n\nClients without an Origin header can connect directly. Browser origins must be the Worker origin or explicitly permitted by `CORS_ORIGINS`; opaque or unexpected origins return 403. Do not embed the admin token in a public browser app.\n\nMCP protocol errors use JSON-RPC error objects rather than the REST error shape. Missing required Accept values return 406, a non-JSON Content-Type returns 415, and oversized bodies return 413. Use the official client to initialize and negotiate the protocol. There is no unauthenticated tool discovery.\n\nFor MCP clients supporting a URL and custom headers:\n\n```json\n{\n  \"mcpServers\": {\n    \"bicho\": {\n      \"url\": \"https:\u002F\u002Fyour-bicho-worker.example\u002Fmcp\",\n      \"headers\": { \"Authorization\": \"Bearer \u003Cadmin-token>\" }\n    }\n  }\n}\n```\n\n## Storage and quotas\n\nEach project defaults to 1000 new events per UTC hour. Set `hourly_limit` when creating a project through the API or MCP, or pass `--hourly-limit=1000` to the local generator. D1 enforces quotas atomically, including concurrent requests. Duplicate occurrence UIDs do not consume quota; rejections before acceptance return 429 and `Retry-After`.\n\nKnown credential keys, Basic\u002FBearer strings and credential URL\u002Fquery values are filtered before indexing and storage. This cannot remove arbitrary secrets or PII embedded in prose or source code. Send only data you intend administrators and connected agents to read. Stored evidence is compact and gzip-compressed in R2.\n\nR2 is written before the D1 index. An ambiguous D1 failure can leave an unreferenced object; Bicho retains it rather than risk deleting committed evidence. Grouping uses exception type\u002Fmessage and the most recent recognized stack location. It does not normalize changing IDs\u002FURLs or infer root causes.\n\n## Operations\n\n### Bot and abuse protection\n\nProject IDs and browser ingest keys are public, not bot protection. Ingest quotas cap accepted events, not incoming requests or Worker cost. Configure [Cloudflare WAF and rate limiting rules](https:\u002F\u002Fdevelopers.cloudflare.com\u002Fwaf\u002Frate-limiting-rules\u002F) on your production custom domain, scoped to ingest, admin API and MCP paths as needed; available controls depend on your plan. Disable unused `workers.dev` and preview URLs to avoid alternate entry points. Avoid interactive challenges on SDK\u002FAPI routes: automated clients cannot complete them. Tune limits for legitimate error bursts and shared IPs. This repo does not configure edge rules.\n\n| HTTP status | Meaning |\n|---|---|\n| 400 | Invalid ID, query, OTLP payload, map, state body or MCP protocol input |\n| 401 | Missing\u002Finvalid admin token; REST errors include the bearer challenge |\n| 403 | Invalid ingest credentials or rejected MCP Origin |\n| 404 | Project\u002Fresource not found within the requested scope |\n| 405 | Method not implemented; GET\u002FDELETE MCP and DELETE event\u002Fissue are unsupported |\n| 406 | MCP client does not accept both JSON and event-stream media types |\n| 409 | An immutable source-map debug ID already has different content |\n| 413 | A request or stored-output byte limit is exceeded |\n| 415 | Unsupported body compression or MCP Content-Type |\n| 429 | Project UTC-hour ingest quota exceeded |\n| 500 | Internal read\u002Fstorage or processing failure |\n| 503 | Ingestion unavailable, admin secret unconfigured or indexed payload unavailable |\n\nCloudflare account and platform limits apply in addition to Bicho's per-project quotas and payload limits.\n\nMonitor `GET \u002Fapi\u002F:project_id\u002Fprocessing`, Worker error logs and ingestion 429\u002F5xx rates. Logs contain request IDs and error names, not raw captured bodies. Data grows without retention deletion, including separate derived objects and unreferenced uploads retained after ambiguous failures. Configure D1\u002FR2 backups and capacity monitoring yourself; this core provides no cleanup or restore job.\n\n## Acknowledgements\n\nBicho uses the [OpenTelemetry Protocol (OTLP)](https:\u002F\u002Fopentelemetry.io\u002Fdocs\u002Fspecs\u002Fotlp\u002F) for error-log ingestion over HTTP JSON and binary protobuf. Vendored schemas and their upstream licenses are listed in [ACKNOWLEDGEMENTS.md](.\u002FACKNOWLEDGEMENTS.md).\n\n## License\n\nCopyright 2026 [Alex Zappa](https:\u002F\u002Falex.zappa.dev\u002F) ([FreshJuice](https:\u002F\u002Ffreshjuice.dev\u002F)). Licensed under Apache-2.0. See [LICENSE](LICENSE) and [ACKNOWLEDGEMENTS.md](ACKNOWLEDGEMENTS.md).\n","Bicho 是一个基于 Cloudflare Workers 的自托管错误追踪系统，支持通过 OTLP\u002FHTTP（JSON 或 Protobuf）及 Sentry SDK 接收错误日志，并将数据持久化至 Cloudflare D1 数据库和 R2 对象存储。核心特性包括轻量级无依赖部署、多语言 SDK 支持（JS\u002FTS、PHP、Rust、Python 等）、MCP（Monitoring Control Plane）工具链用于问题调查，以及无需 OpenTelemetry Collector 的直连接入能力。适用于中小团队或注重数据主权的 Web 应用、Serverless 服务及边缘架构场景，尤其适合已使用 Cloudflare 生态并希望规避 SaaS 错误监控服务合规与成本风险的开发者。",2,"2026-11-24 04:34:43","CREATED_QUERY"]