.claude/skills/cloudflare-workers-subrequest-limit/SKILL.md
Fix "Too many subrequests" error in Cloudflare Workers. Use when: (1) Worker returns 500 with message "Too many subrequests", (2) Making multiple fetch calls in a loop (e.g., creating blobs for each file), (3) Processing batches of items that each require an API call. Covers the 50 subrequest limit and strategies to work around it.
npx skillsauth add Dbochman/dotfiles cloudflare-workers-subrequest-limitInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Cloudflare Workers have a limit of 50 subrequests (fetch calls) per invocation. When processing multiple items that each require an API call (e.g., creating GitHub blobs for multiple files), you'll hit this limit and get a 500 error.
For GitHub Trees API, use inline content instead of creating separate blobs:
// BEFORE: Creates N+1 subrequests (1 per file + 1 for tree)
const blobShas = await Promise.all(
files.map(file => createBlob(file.content, env)) // ❌ Each is a subrequest
);
// AFTER: Creates only 1 subrequest (tree with inline content)
const treeItems = files.map(file => ({
path: file.path,
mode: '100644',
type: 'blob',
content: file.content, // ✅ Inline content, no separate blob
}));
await createTree(baseTreeSha, treeItems, env); // Single subrequest
If you must make individual calls, batch them:
const BATCH_SIZE = 40; // Leave headroom below 50
async function processBatches(items: Item[], env: Env) {
const results = [];
for (let i = 0; i < items.length; i += BATCH_SIZE) {
const batch = items.slice(i, i + BATCH_SIZE);
const batchResults = await Promise.all(
batch.map(item => processItem(item, env))
);
results.push(...batchResults);
// If more batches remain, you need a new Worker invocation
// Consider using Durable Objects or queuing
}
return results;
}
For operations exceeding 50 subrequests, split across multiple Worker invocations or use Durable Objects which have their own subrequest budget per alarm/request.
Have the client send already-aggregated data to reduce server-side API calls.
Atomic multi-file GitHub commit with 60+ files:
// This approach works for any number of files
// because createTree accepts inline content
export async function commitFilesAtomic(
files: Array<{ path: string; content: string }>,
deletions: string[],
message: string,
parentSha: string,
env: Env
): Promise<string> {
const baseTreeSha = await getCommitTree(parentSha, env); // 1 subrequest
// Build tree items with INLINE content (no blob creation)
const treeItems = files.map(file => ({
path: file.path,
mode: '100644' as const,
type: 'blob' as const,
content: file.content, // Inline!
}));
// Add deletions
for (const path of deletions) {
treeItems.push({ path, mode: '100644', type: 'blob', sha: null });
}
const newTreeSha = await createTree(baseTreeSha, treeItems, env); // 1 subrequest
const newCommitSha = await createCommit(newTreeSha, parentSha, message, env); // 1 subrequest
await updateRef(newCommitSha, parentSha, env); // 2 subrequests (get + update)
return newCommitSha; // Total: 5 subrequests for ANY number of files
}
tools
Use exact configured Reolink cameras through the local Home Hub for availability and power status, fresh stills, visual commentary, protected Dylan/Julia/household sharing, and reversible spotlight control. Supports trusted owner tasks and explicitly scoped proactive automations; not for Nest or Ring cameras, arbitrary recipients, recordings, account changes, or raw camera APIs.
data-ai
Privately manage Dylan and Julia's household plant inventory and care history by physical location, bed, and exact Flower Cam view. Use for confirmed plant onboarding from camera conversations, camera- or bed-filtered inventory, record corrections, individual or whole-bed care, and private filtered exports. Pair with reolink-camera when an owner asks about plants visible in Flower Cam images.
testing
Inspect and control the physically secured Reachy Mini at Crosstown through ClawBody. Use for requests to check Reachy, look around, express an emotion, play any official emotion or dance preset, speak proactively, mute or unmute its microphone, stop movement, or describe what its camera sees.
tools
Handle Reachy/iMessage handoffs, selective durable memory, forgetting, and diagnostics; automatic context comes from the gateway plugin.