[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6F3W7R183MKG4BDCXJ0Z1D1":3,"skill-same:01M6F3W7R183MKG4BDCXJ0Z1D1":79},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":56,"commitSha":57,"skillDirectory":58,"forksCount":59,"repositoryHtmlUrl":60,"repositoryHomepageUrl":61,"ownerHtmlUrl":62,"ownerBlogUrl":6,"ownerDescription":63,"updatedAt":64,"install":65,"resources":78},"01M6F3W7R183MKG4BDCXJ0Z1D1","electric-debugging",null,"Troubleshoot Electric sync issues. Covers fast-loop detection from CDN\u002Fproxy cache key misconfiguration, stale cache diagnosis (StaleCacheError), MissingHeadersError from CORS misconfiguration, 409 shape expired handling, SSE proxy buffering (nginx proxy_buffering off, Caddy flush_interval -1), HTTP\u002F1.1 6-connection limit in local dev (Caddy HTTP\u002F2 proxy), WAL growth from replication slots (max_slot_wal_keep_size), Vercel CDN cache issues, and onError\u002Fbackoff behavior. Load when shapes are not receiving updates, sync is slow, or errors appear in the console.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Felectric-sql\u002Felectric\u002Felectric-debugging\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"electric debugging","debugging","loop","error","guides","diagnosis","caddy","local","max","fetch","src","troubleshoot","wal","nginx","website","issues","packages","sql","sync","auth","2026-11-10 10:12:30",false,"---\nname: electric-debugging\ndescription: >\n  Troubleshoot Electric sync issues. Covers fast-loop detection from CDN\u002Fproxy\n  cache key misconfiguration, stale cache diagnosis (StaleCacheError),\n  MissingHeadersError from CORS misconfiguration, 409 shape expired handling,\n  SSE proxy buffering (nginx proxy_buffering off, Caddy flush_interval -1),\n  HTTP\u002F1.1 6-connection limit in local dev (Caddy HTTP\u002F2 proxy), WAL growth\n  from replication slots (max_slot_wal_keep_size), Vercel CDN cache issues,\n  and onError\u002Fbackoff behavior. Load when shapes are not receiving updates,\n  sync is slow, or errors appear in the console.\ntype: lifecycle\nlibrary: electric\nlibrary_version: '1.5.10'\nrequires:\n  - electric-shapes\n  - electric-proxy-auth\nsources:\n  - 'electric-sql\u002Felectric:packages\u002Ftypescript-client\u002Fsrc\u002Fclient.ts'\n  - 'electric-sql\u002Felectric:packages\u002Ftypescript-client\u002Fsrc\u002Ffetch.ts'\n  - 'electric-sql\u002Felectric:packages\u002Ftypescript-client\u002Fsrc\u002Ferror.ts'\n  - 'electric-sql\u002Felectric:website\u002Fdocs\u002Fguides\u002Ftroubleshooting.md'\n---\n\nThis skill builds on electric-shapes and electric-proxy-auth. Read those first.\n\n# Electric — Debugging Sync Issues\n\n## Setup\n\nEnable debug logging to see retry and state machine behavior:\n\n```ts\nimport { ShapeStream, FetchError } from '@electric-sql\u002Fclient'\n\nconst stream = new ShapeStream({\n  url: '\u002Fapi\u002Ftodos',\n  backoffOptions: {\n    initialDelay: 1000,\n    maxDelay: 32000,\n    multiplier: 2,\n    debug: true, \u002F\u002F Logs retry attempts\n  },\n  onError: (error) => {\n    if (error instanceof FetchError) {\n      console.error(`Sync error: ${error.status} at ${error.url}`, error.json)\n    }\n    return {} \u002F\u002F Always return {} to retry\n  },\n})\n```\n\n## Core Patterns\n\n### Error retry behavior\n\n| Error                 | Auto-retry?                | Action                                                        |\n| --------------------- | -------------------------- | ------------------------------------------------------------- |\n| 5xx server errors     | Yes (exponential backoff)  | Wait and retry                                                |\n| 429 rate limit        | Yes (respects Retry-After) | Wait and retry                                                |\n| Network errors        | Yes (exponential backoff)  | Wait and retry                                                |\n| 4xx (non-429)         | No                         | Calls `onError` — return `{}` to retry manually               |\n| 409 shape expired     | Yes (automatic reset)      | Client resets and refetches                                   |\n| `MissingHeadersError` | Never                      | Fix CORS\u002Fproxy — not retryable even if `onError` returns `{}` |\n\n### Diagnosing MissingHeadersError\n\nThis error means Electric response headers (`electric-offset`, `electric-handle`) are being stripped, usually by CORS:\n\n```\nMissingHeadersError: This is often due to a proxy not setting CORS correctly\nso that all Electric headers can be read by the client.\n```\n\nFix: expose Electric headers in proxy CORS configuration:\n\n```ts\nheaders.set(\n  'Access-Control-Expose-Headers',\n  'electric-offset, electric-handle, electric-schema, electric-cursor'\n)\n```\n\n### Diagnosing fast-loop detection\n\nConsole message: \"Detected possible fast loop\" with diagnostic info.\n\nCause: proxy\u002FCDN cache key doesn't include `handle` and `offset` query params, so the client gets the same stale response repeatedly.\n\nFix: ensure your proxy\u002FCDN includes all query parameters in its cache key.\n\nFor Vercel, add to `vercel.json`:\n\n```json\n{\n  \"headers\": [\n    {\n      \"source\": \"\u002Fapi\u002F(.*)\",\n      \"headers\": [\n        { \"key\": \"CDN-Cache-Control\", \"value\": \"no-store\" },\n        { \"key\": \"Vercel-CDN-Cache-Control\", \"value\": \"no-store\" }\n      ]\n    }\n  ]\n}\n```\n\n## Common Mistakes\n\n### HIGH Proxy or CDN not including query params in cache key\n\nWrong:\n\n```nginx\n# nginx caching without query params in key\nproxy_cache_key $scheme$host$uri;\n```\n\nCorrect:\n\n```nginx\n# Include query params (handle, offset) in cache key\nproxy_cache_key $scheme$host$request_uri;\n```\n\nFast-loop detection fires after 5 requests in 500ms at the same offset. The client auto-clears caches once, then applies backoff, then throws after 5 consecutive detections.\n\nSource: `packages\u002Ftypescript-client\u002Fsrc\u002Fclient.ts:929-1002`\n\n### HIGH SSE responses buffered by proxy\n\nWrong:\n\n```nginx\nlocation \u002Fv1\u002Fshape {\n  proxy_pass http:\u002F\u002Felectric:3000;\n  # Default: proxy_buffering on — SSE responses delayed\n}\n```\n\nCorrect:\n\n```nginx\nlocation \u002Fv1\u002Fshape {\n  proxy_pass http:\u002F\u002Felectric:3000;\n  proxy_buffering off;\n}\n```\n\nFor Caddy:\n\n```\nreverse_proxy localhost:3000 {\n  flush_interval -1\n}\n```\n\nNginx and Caddy buffer responses by default, causing long delays for SSE live updates. Disable buffering for Electric endpoints. Do NOT disable caching entirely — Electric uses cache headers for request collapsing.\n\nSource: `website\u002Fdocs\u002Fguides\u002Ftroubleshooting.md:69-109`\n\n### MEDIUM Running 6+ shapes in local dev without HTTP\u002F2\n\nWrong:\n\n```sh\n# Running Electric directly on localhost:3000\n# With 7+ shapes, browser HTTP\u002F1.1 queues all requests (6 connection limit)\n```\n\nCorrect:\n\n```sh\n# Run Caddy as HTTP\u002F2 proxy on host (not in Docker — Docker prevents HTTP\u002F2)\ncaddy run --config - --adapter caddyfile \u003C\u003CEOF\nlocalhost:3001 {\n  reverse_proxy localhost:3000\n}\nEOF\n```\n\nBrowser HTTP\u002F1.1 limits to 6 TCP connections per origin. With many shapes, requests queue behind each other. Use Caddy as a local HTTP\u002F2 proxy.\n\nSource: `website\u002Fdocs\u002Fguides\u002Ftroubleshooting.md:28-53`\n\n### HIGH Leaving replication slot active when Electric is stopped\n\nWrong:\n\n```sh\ndocker stop electric\n# Replication slot retains WAL indefinitely — disk fills up\n```\n\nCorrect:\n\n```sh\ndocker stop electric\n\n# Drop slot when stopping for extended periods\npsql -c \"SELECT pg_drop_replication_slot('electric_slot_default');\"\n\n# Or set a safety limit\npsql -c \"ALTER SYSTEM SET max_slot_wal_keep_size = '10GB';\"\npsql -c \"SELECT pg_reload_conf();\"\n```\n\nReplication slots retain WAL indefinitely when Electric is disconnected. Postgres disk fills up. Either drop the slot or set `max_slot_wal_keep_size`.\n\nSource: `website\u002Fdocs\u002Fguides\u002Ftroubleshooting.md:203-316`\n\nSee also: electric-deployment\u002FSKILL.md — Many sync issues stem from deployment configuration.\nSee also: electric-shapes\u002FSKILL.md — onError semantics and backoff behavior.\n\n## Version\n\nTargets @electric-sql\u002Fclient v1.5.10.\n\n","This skill builds on electric-shapes and electric-proxy-auth. Read those first.\n\n# Electric — Debugging Sync Issues\n\n## Setup\n\nEnable debug logging to see retry and state machine behavior:\n\n```ts\nimport { ShapeStream, FetchError } from '@electric-sql\u002Fclient'\n\nconst stream = new ShapeStream({\n  url: '\u002Fapi\u002Ftodos',\n  backoffOptions: {\n    initialDelay: 1000,\n    maxDelay: 32000,\n    multiplier: 2,\n    debug: true, \u002F\u002F Logs retry attempts\n  },\n  onError: (error) => {\n    if (error instanceof FetchError) {\n      console.error(`Sync error: ${error.status} at ${error.url}`, error.json)\n    }\n    return {} \u002F\u002F Always return {} to retry\n  },\n})\n```\n\n## Core Patterns\n\n### Error retry behavior\n\n| Error                 | Auto-retry?                | Action                                                        |\n| --------------------- | -------------------------- | ------------------------------------------------------------- |\n| 5xx server errors     | Yes (exponential backoff)  | Wait and retry                                                |\n| 429 rate limit        | Yes (respects Retry-After) | Wait and retry                                                |\n| Network errors        | Yes (exponential backoff)  | Wait and retry                                                |\n| 4xx (non-429)         | No                         | Calls `onError` — return `{}` to retry manually               |\n| 409 shape expired     | Yes (automatic reset)      | Client resets and refetches                                   |\n| `MissingHeadersError` | Never                      | Fix CORS\u002Fproxy — not retryable even if `onError` returns `{}` |\n\n### Diagnosing MissingHeadersError\n\nThis error means Electric response headers (`electric-offset`, `electric-handle`) are being stripped, usually by CORS:\n\n```\nMissingHeadersError: This is often due to a proxy not setting CORS correctly\nso that all Electric headers can be read by the client.\n```\n\nFix: expose Electric headers in proxy CORS configuration:\n\n```ts\nheaders.set(\n  'Access-Control-Expose-Headers',\n  'electric-offset, electric-handle, electric-schema, electric-cursor'\n)\n```\n\n### Diagnosing fast-loop detection\n\nConsole message: \"Detected possible fast loop\" with diagnostic info.\n\nCause: proxy\u002FCDN cache key doesn't include `handle` and `offset` query params, so the client gets the same stale response repeatedly.\n\nFix: ensure your proxy\u002FCDN includes all query parameters in its cache key.\n\nFor Vercel, add to `vercel.json`:\n\n```json\n{\n  \"headers\": [\n    {\n      \"source\": \"\u002Fapi\u002F(.*)\",\n      \"headers\": [\n        { \"key\": \"CDN-Cache-Control\", \"value\": \"no-store\" },\n        { \"key\": \"Vercel-CDN-Cache-Control\", \"value\": \"no-store\" }\n      ]\n    }\n  ]\n}\n```\n\n## Common Mistakes\n\n### HIGH Proxy or CDN not including query params in cache key\n\nWrong:\n\n```nginx\n# nginx caching without query params in key\nproxy_cache_key $scheme$host$uri;\n```\n\nCorrect:\n\n```nginx\n# Include query params (handle, offset) in cache key\nproxy_cache_key $scheme$host$request_uri;\n```\n\nFast-loop detection fires after 5 requests in 500ms at the same offset. The client auto-clears caches once, then applies backoff, then throws after 5 consecutive detections.\n\nSource: `packages\u002Ftypescript-client\u002Fsrc\u002Fclient.ts:929-1002`\n\n### HIGH SSE responses buffered by proxy\n\nWrong:\n\n```nginx\nlocation \u002Fv1\u002Fshape {\n  proxy_pass http:\u002F\u002Felectric:3000;\n  # Default: proxy_buffering on — SSE responses delayed\n}\n```\n\nCorrect:\n\n```nginx\nlocation \u002Fv1\u002Fshape {\n  proxy_pass http:\u002F\u002Felectric:3000;\n  proxy_buffering off;\n}\n```\n\nFor Caddy:\n\n```\nreverse_proxy localhost:3000 {\n  flush_interval -1\n}\n```\n\nNginx and Caddy buffer responses by default, causing long delays for SSE live updates. Disable buffering for Electric endpoints. Do NOT disable caching entirely — Electric uses cache headers for request collapsing.\n\nSource: `website\u002Fdocs\u002Fguides\u002Ftroubleshooting.md:69-109`\n\n### MEDIUM Running 6+ shapes in local dev without HTTP\u002F2\n\nWrong:\n\n```sh\n# Running Electric directly on localhost:3000\n# With 7+ shapes, browser HTTP\u002F1.1 queues all requests (6 connection limit)\n```\n\nCorrect:\n\n```sh\n# Run Caddy as HTTP\u002F2 proxy on host (not in Docker — Docker prevents HTTP\u002F2)\ncaddy run --config - --adapter caddyfile \u003C\u003CEOF\nlocalhost:3001 {\n  reverse_proxy localhost:3000\n}\nEOF\n```\n\nBrowser HTTP\u002F1.1 limits to 6 TCP connections per origin. With many shapes, requests queue behind each other. Use Caddy as a local HTTP\u002F2 proxy.\n\nSource: `website\u002Fdocs\u002Fguides\u002Ftroubleshooting.md:28-53`\n\n### HIGH Leaving replication slot active when Electric is stopped\n\nWrong:\n\n```sh\ndocker stop electric\n# Replication slot retains WAL indefinitely — disk fills up\n```\n\nCorrect:\n\n```sh\ndocker stop electric\n\n# Drop slot when stopping for extended periods\npsql -c \"SELECT pg_drop_replication_slot('electric_slot_default');\"\n\n# Or set a safety limit\npsql -c \"ALTER SYSTEM SET max_slot_wal_keep_size = '10GB';\"\npsql -c \"SELECT pg_reload_conf();\"\n```\n\nReplication slots retain WAL indefinitely when Electric is disconnected. Postgres disk fills up. Either drop the slot or set `max_slot_wal_keep_size`.\n\nSource: `website\u002Fdocs\u002Fguides\u002Ftroubleshooting.md:203-316`\n\nSee also: electric-deployment\u002FSKILL.md — Many sync issues stem from deployment configuration.\nSee also: electric-shapes\u002FSKILL.md — onError semantics and backoff behavior.\n\n## Version\n\nTargets @electric-sql\u002Fclient v1.5.10.\n\n",{"name":5,"type":44,"library":45,"sources":46,"requires":51,"description":54,"library_version":55},"lifecycle","electric",[47,48,49,50],"electric-sql\u002Felectric:packages\u002Ftypescript-client\u002Fsrc\u002Fclient.ts","electric-sql\u002Felectric:packages\u002Ftypescript-client\u002Fsrc\u002Ffetch.ts","electric-sql\u002Felectric:packages\u002Ftypescript-client\u002Fsrc\u002Ferror.ts","electric-sql\u002Felectric:website\u002Fdocs\u002Fguides\u002Ftroubleshooting.md",[52,53],"electric-shapes","electric-proxy-auth","Troubleshoot Electric sync issues. Covers fast-loop detection from CDN\u002Fproxy cache key misconfiguration, stale cache diagnosis (StaleCacheError), MissingHeadersError from CORS misconfiguration, 409 shape expired handling, SSE proxy buffering (nginx proxy_buffering off, Caddy flush_interval -1), HTTP\u002F1.1 6-connection limit in local dev (Caddy HTTP\u002F2 proxy), WAL growth from replication slots (max_slot_wal_keep_size), Vercel CDN cache issues, and onError\u002Fbackoff behavior. Load when shapes are not receiving updates, sync is slow, or errors appear in the console.\n","1.5.10","main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Felectric-sql\u002Felectric\u002Felectric-debugging",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":66,"prompt":76,"zipAvailable":77},[67,70,73],{"tool":68,"command":69},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill electric-debugging",{"tool":71,"command":72},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill electric-debugging",{"tool":74,"command":75},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill electric-debugging","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Felectric-sql\u002Felectric\u002Felectric-debugging\u002FSKILL.md",true,[],[80,89,98,107,113,119],{"skillNo":81,"name":82,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":83,"categories":84,"keywords":85,"publishedAt":39},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[],[86,87,88],"model","model hierarchy","model hierarchy skill",{"skillNo":90,"name":91,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":39},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[],[95,96,97],"MCP","zoom","zoom mcp",{"skillNo":99,"name":100,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":101,"categories":102,"keywords":103,"publishedAt":39},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[104,105,106,96],"sdk","zoom apps sdk","apps",{"skillNo":108,"name":109,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":39},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[109],{"skillNo":114,"name":115,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":39},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[],[115],{"skillNo":120,"name":121,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":122,"categories":123,"keywords":124,"publishedAt":39},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[121]]